Skip to content
Snippets Groups Projects
Commit 72240049 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Protect the batch download list/queue from exceeding allowed files per day

Address issue raised in discussion with x-bit regarding issue #938
parent 25ba1249
No related branches found
No related tags found
No related merge requests found
...@@ -263,6 +263,11 @@ bool sbbs_t::start_batch_download() ...@@ -263,6 +263,11 @@ bool sbbs_t::start_batch_download()
iniFreeStringList(ini); iniFreeStringList(ini);
return false; return false;
} }
if (useron.dtoday + file_count > user_downloads_per_day(&cfg, &useron)) {
bputs(text[NoMoreDownloads]);
iniFreeStringList(ini);
return false;
}
str_list_t filenames = iniGetSectionList(ini, NULL); str_list_t filenames = iniGetSectionList(ini, NULL);
if (file_count == 1) { // Only one file in the queue? Perform a non-batch (e.g. XMODEM) download if (file_count == 1) { // Only one file in the queue? Perform a non-batch (e.g. XMODEM) download
...@@ -737,7 +742,11 @@ bool sbbs_t::addtobatdl(file_t* f) ...@@ -737,7 +742,11 @@ bool sbbs_t::addtobatdl(file_t* f)
bool result = false; bool result = false;
str_list_t filenames = iniGetSectionList(ini, /* prefix: */ NULL); str_list_t filenames = iniGetSectionList(ini, /* prefix: */ NULL);
if (strListCount(filenames) >= cfg.max_batdn) { size_t file_count = strListCount(filenames);
if (useron.dtoday + file_count > user_downloads_per_day(&cfg, &useron)) {
bprintf(text[CantAddToQueue], f->name);
bputs(text[NoMoreDownloads]);
} else if (file_count >= cfg.max_batdn) {
bprintf(text[CantAddToQueue], f->name); bprintf(text[CantAddToQueue], f->name);
bputs(text[BatchDlQueueIsFull]); bputs(text[BatchDlQueueIsFull]);
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment