Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 7876b5b8 authored by rswindell's avatar rswindell

start_batch_download (bbs.batch_download) now checks if download queue is

empty, now returns BOOL instead of VOID.
parent db34a462
......@@ -201,12 +201,6 @@ void sbbs_t::batchmenu()
}
break;
case 'D':
if(useron.rest&FLAG('D')) {
bputs(text[R_Download]);
break; }
if(!batdn_total) {
bputs(text[DownloadQueueIsEmpty]);
break; }
start_batch_download();
break;
case 'L':
......@@ -333,7 +327,7 @@ void sbbs_t::batchmenu()
/****************************************************************************/
/* Download files from batch queue */
/****************************************************************************/
void sbbs_t::start_batch_download()
BOOL sbbs_t::start_batch_download()
{
char ch;
char tmp[32];
......@@ -349,16 +343,21 @@ void sbbs_t::start_batch_download()
time_t start,end,t;
struct tm tm;
if(batdn_total==0) {
bputs(text[DownloadQueueIsEmpty]);
return(FALSE);
}
if(useron.rest&FLAG('D')) { /* Download restriction */
bputs(text[R_Download]);
return; }
return(FALSE);
}
for(i=0,totalcdt=0;i<batdn_total;i++)
totalcdt+=batdn_cdt[i];
if(!(useron.exempt&FLAG('D'))
&& totalcdt>useron.cdt+useron.freecdt) {
bprintf(text[YouOnlyHaveNCredits]
,ultoac(useron.cdt+useron.freecdt,tmp));
return;
return(FALSE);
}
for(i=0,totalsize=totaltime=0;i<batdn_total;i++) {
......@@ -368,13 +367,13 @@ void sbbs_t::start_batch_download()
}
if(!(useron.exempt&FLAG('T')) && !SYSOP && totaltime>timeleft) {
bputs(text[NotEnoughTimeToDl]);
return;
return(FALSE);
}
menu("batdprot");
if(!create_batchdn_lst())
return;
return(FALSE);
if(!create_bimodem_pth())
return;
return(FALSE);
ASYNC;
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
......@@ -386,13 +385,13 @@ void sbbs_t::start_batch_download()
ungetkey(useron.prot);
ch=(char)getkeys(str,0);
if(ch=='Q' || sys_status&SS_ABORT)
return;
return(FALSE);
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->batdlcmd[0] && cfg.prot[i]->mnemonic==ch
&& chk_ar(cfg.prot[i]->ar,&useron))
break;
if(i>=cfg.total_prots)
return; /* no protocol selected */
return(FALSE); /* no protocol selected */
xfrprot=i;
list=NULL;
......@@ -429,7 +428,7 @@ void sbbs_t::start_batch_download()
list_len=strlen(list)+1; /* add one for ' ' */
if((list=(char*)realloc(list,list_len+strlen(path)+1 /* add one for '\0'*/))==NULL) {
errormsg(WHERE,ERR_ALLOC,"list",list_len+strlen(path));
return;
return(FALSE);
}
if(!list_len)
strcpy(list,path);
......@@ -468,6 +467,8 @@ void sbbs_t::start_batch_download()
autohangup();
if(list!=NULL)
free(list);
return(TRUE);
}
/****************************************************************************/
......
......@@ -1507,9 +1507,7 @@ js_batchdownload(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
sbbs->start_batch_download();
*rval = JSVAL_VOID;
*rval = BOOLEAN_TO_JSVAL(sbbs->start_batch_download());
return(JS_TRUE);
}
......@@ -2500,7 +2498,7 @@ static jsMethodSpec js_bbs_functions[] = {
{"batch_menu", js_batchmenu, 0, JSTYPE_VOID, ""
,JSDOCSTR("enter the batch file transfer menu")
},
{"batch_download", js_batchdownload, 0, JSTYPE_VOID, ""
{"batch_download", js_batchdownload, 0, JSTYPE_BOOLEAN, ""
,JSDOCSTR("start the batch download")
},
{"batch_add_list", js_batchaddlist, 1, JSTYPE_VOID, JSDOCSTR("filename")
......
......@@ -600,7 +600,7 @@ public:
bool create_bimodem_pth(void);
void batch_upload(void);
void batch_download(int xfrprot);
void start_batch_download(void);
BOOL start_batch_download(void);
/* tmp_xfer.cpp */
void temp_xfer(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment