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

If file already in download queue, don't display protocol selection

Use localizable [Q]uit key

Removed trailing whitespace
parent 673210b0
No related branches found
No related tags found
No related merge requests found
Pipeline #6919 failed
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "sbbs.h" #include "sbbs.h"
#include "filedat.h" #include "filedat.h"
#define BF_MAX 26 /* Batch Flag max: A-Z */ #define BF_MAX 26 /* Batch Flag max: A-Z */
int extdesclines(char *str); int extdesclines(char *str);
...@@ -96,9 +96,9 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -96,9 +96,9 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
if(thisnode.action!=NODE_LFIL) { /* was a sync */ if(thisnode.action!=NODE_LFIL) { /* was a sync */
if(getnodedat(cfg.node_num,&thisnode,true)==0) { if(getnodedat(cfg.node_num,&thisnode,true)==0) {
thisnode.action=NODE_LFIL; thisnode.action=NODE_LFIL;
putnodedat(cfg.node_num,&thisnode); putnodedat(cfg.node_num,&thisnode);
} }
} }
} }
m = 0; // current file index m = 0; // current file index
...@@ -114,18 +114,18 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -114,18 +114,18 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
if((i=batchflagprompt(&smb, bf, file_row, letter-'A', file_count))==2) { if((i=batchflagprompt(&smb, bf, file_row, letter-'A', file_count))==2) {
m=anchor; m=anchor;
found-=letter-'A'; found-=letter-'A';
letter='A'; letter='A';
} }
else if(i==3) { else if(i==3) {
if((int)anchor-(letter-'A')<0) { if((int)anchor-(letter-'A')<0) {
m=0; m=0;
found=0; found=0;
} }
else { else {
m=anchor-(letter-'A'); m=anchor-(letter-'A');
found-=letter-'A'; found-=letter-'A';
} }
letter='A'; letter='A';
} }
else if((int)i==-1) { else if((int)i==-1) {
found = -1; found = -1;
...@@ -134,10 +134,10 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -134,10 +134,10 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
else else
break; break;
getnodedat(cfg.node_num,&thisnode,0); getnodedat(cfg.node_num,&thisnode,0);
nodesync(); nodesync();
} }
else else
break; break;
} }
if(m < file_count) if(m < file_count)
f = &file_list[m]; f = &file_list[m];
...@@ -165,7 +165,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -165,7 +165,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
p = strcasestr(f->author_org, filespec); p = strcasestr(f->author_org, filespec);
if(p == NULL) { if(p == NULL) {
m++; m++;
continue; continue;
} }
} }
if(useron.misc&BATCHFLAG && letter=='A' && found && !tofile if(useron.misc&BATCHFLAG && letter=='A' && found && !tofile
...@@ -219,7 +219,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -219,7 +219,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
bputs("\xba\r\n\xc8\xcd"); bputs("\xba\r\n\xc8\xcd");
for(c=0;c<d;c++) for(c=0;c<d;c++)
outchar('\xcd'); outchar('\xcd');
bputs("\xbc\r\n"); bputs("\xbc\r\n");
} }
} }
} }
...@@ -230,7 +230,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -230,7 +230,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
else { else {
sprintf(hdr,text[ShortHdrLib],i+1,cfg.lib[usrlib[i]]->sname); sprintf(hdr,text[ShortHdrLib],i+1,cfg.lib[usrlib[i]]->sname);
bputs("\1[\1>\r\n"); bputs("\1[\1>\r\n");
bputs(hdr); bputs(hdr);
c=bstrlen(hdr); c=bstrlen(hdr);
} }
if(tofile) { if(tofile) {
...@@ -238,7 +238,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -238,7 +238,7 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
} }
else { else {
sprintf(hdr,text[ShortHdrDir],j+1,cfg.dir[dirnum]->lname); sprintf(hdr,text[ShortHdrDir],j+1,cfg.dir[dirnum]->lname);
bputs(hdr); bputs(hdr);
c+=bstrlen(hdr); c+=bstrlen(hdr);
} }
if(tofile) { if(tofile) {
...@@ -249,9 +249,9 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -249,9 +249,9 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
attr(cfg.color[clr_filelstline]); attr(cfg.color[clr_filelstline]);
while(c--) while(c--)
outchar('\xC4'); outchar('\xC4');
CRLF; CRLF;
} }
} }
} }
int currow = row; int currow = row;
next=m; next=m;
...@@ -273,11 +273,11 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -273,11 +273,11 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
disp=listfile(f, dirnum, nulstr, letter, longest); disp=listfile(f, dirnum, nulstr, letter, longest);
if(!disp && letter>'A') { if(!disp && letter>'A') {
next=m-1; next=m-1;
letter--; letter--;
} }
else { else {
disp=1; disp=1;
found++; found++;
} }
if(sys_status&SS_ABORT) { if(sys_status&SS_ABORT) {
found = -1; found = -1;
...@@ -306,34 +306,34 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons ...@@ -306,34 +306,34 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons
} }
if(i==2) { if(i==2) {
next=anchor; next=anchor;
found-=(letter-'A')+1; found-=(letter-'A')+1;
} }
else if(i==3) { else if(i==3) {
if((int)anchor-((letter-'A'+1))<0) { if((int)anchor-((letter-'A'+1))<0) {
next=0; next=0;
found=0; found=0;
} }
else { else {
next=anchor-((letter-'A'+1)); next=anchor-((letter-'A'+1));
found-=letter-'A'+1; found-=letter-'A'+1;
} }
} }
getnodedat(cfg.node_num,&thisnode,0); getnodedat(cfg.node_num,&thisnode,0);
nodesync(); nodesync();
letter='A'; letter='A';
} }
else else
letter++; letter++;
} }
if(useron.misc&BATCHFLAG && !tofile if(useron.misc&BATCHFLAG && !tofile
&& lncntr>=rows-2) { && lncntr>=rows-2) {
lncntr=0; /* defeat pause() */ lncntr=0; /* defeat pause() */
flagprompt=1; flagprompt=1;
} }
m=next; m=next;
if(mode & FL_FIND) continue; if(mode & FL_FIND) continue;
if(filespec[0] && !strchr(filespec,'*') && !strchr(filespec,'?') && m) if(filespec[0] && !strchr(filespec,'*') && !strchr(filespec,'?') && m)
break; break;
} }
freefiles(file_list, file_count); freefiles(file_list, file_count);
...@@ -382,15 +382,15 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch ...@@ -382,15 +382,15 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch
if(f->extdesc != NULL && *f->extdesc && !(useron.misc&EXTDESC)) if(f->extdesc != NULL && *f->extdesc && !(useron.misc&EXTDESC))
outchar('+'); outchar('+');
else else
outchar(' '); outchar(' ');
if(useron.misc&BATCHFLAG) { if(useron.misc&BATCHFLAG) {
attr(curatr ^ HIGH); attr(curatr ^ HIGH);
bprintf("%c",letter); bprintf("%c",letter);
} }
cdt = f->cost; cdt = f->cost;
if(f->size == -1) { if(f->size == -1) {
exist = false; exist = false;
size_attr = clr_err; size_attr = clr_err;
} }
else if((cfg.dir[dirnum]->misc & (DIR_FREE | DIR_FCHK)) == (DIR_FREE | DIR_FCHK)) else if((cfg.dir[dirnum]->misc & (DIR_FREE | DIR_FCHK)) == (DIR_FREE | DIR_FCHK))
cdt = getfilesize(&cfg, f); cdt = getfilesize(&cfg, f);
...@@ -406,7 +406,7 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch ...@@ -406,7 +406,7 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch
attr(curatr^(HIGH|BLINK)); attr(curatr^(HIGH|BLINK));
bprintf("%6s", text[FREE]); bprintf("%6s", text[FREE]);
} }
else else
bprintf("%6s", bytes); bprintf("%6s", bytes);
} }
else { else {
...@@ -414,7 +414,7 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch ...@@ -414,7 +414,7 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch
attr(curatr^(HIGH|BLINK)); attr(curatr^(HIGH|BLINK));
bprintf("%7s", text[FREE]); bprintf("%7s", text[FREE]);
} }
else else
bprintf("%7s", bytes); bprintf("%7s", bytes);
} }
if(exist) if(exist)
...@@ -444,7 +444,7 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch ...@@ -444,7 +444,7 @@ bool sbbs_t::listfile(file_t* f, const int dirnum, const char *search, const ch
else { else {
bputs(P_TRUNCATE, fdesc); bputs(P_TRUNCATE, fdesc);
} }
CRLF; CRLF;
} else { } else {
truncsp(ext); truncsp(ext);
while(strncmp(ext, "\r\n", 2) == 0 while(strncmp(ext, "\r\n", 2) == 0
...@@ -495,7 +495,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -495,7 +495,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
menu("batflag"); menu("batflag");
if(lncntr) if(lncntr)
pause(); pause();
return(2); return(2);
} }
if(ch==quit_key() || sys_status&SS_ABORT) if(ch==quit_key() || sys_status&SS_ABORT)
return(-1); return(-1);
...@@ -511,14 +511,14 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -511,14 +511,14 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
if(ch=='B' || ch=='D') { /* Flag for batch download */ if(ch=='B' || ch=='D') { /* Flag for batch download */
if(useron.rest&FLAG('D')) { if(useron.rest&FLAG('D')) {
bputs(text[R_Download]); bputs(text[R_Download]);
return(2); return(2);
} }
if(total==1) { if(total==1) {
addtobatdl(bf[0]); addtobatdl(bf[0]);
if(ch=='D') if(ch=='D')
start_batch_download(); start_batch_download();
CRLF; CRLF;
return(2); return(2);
} }
link_list_t saved_hotspots = mouse_hotspots; link_list_t saved_hotspots = mouse_hotspots;
ZERO_VAR(mouse_hotspots); ZERO_VAR(mouse_hotspots);
...@@ -538,7 +538,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -538,7 +538,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
for(c=0;c<d;c++) { for(c=0;c<d;c++) {
if(batdn_total() >= cfg.max_batdn) { if(batdn_total() >= cfg.max_batdn) {
bprintf(text[BatchDlQueueIsFull],str+c); bprintf(text[BatchDlQueueIsFull],str+c);
break; break;
} }
if(str[c]=='*' || strchr(str+c,'.')) { /* filename or spec given */ if(str[c]=='*' || strchr(str+c,'.')) { /* filename or spec given */
// f.dir=dirnum; // f.dir=dirnum;
...@@ -548,33 +548,33 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -548,33 +548,33 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
for(i=0;i<total;i++) { for(i=0;i<total;i++) {
if(batdn_total() >= cfg.max_batdn) { if(batdn_total() >= cfg.max_batdn) {
bprintf(text[BatchDlQueueIsFull],str+c); bprintf(text[BatchDlQueueIsFull],str+c);
break; break;
} }
if(filematch(bf[i]->name, str+c)) { if(filematch(bf[i]->name, str+c)) {
addtobatdl(bf[i]); addtobatdl(bf[i]);
} }
} }
} }
if(strchr(str+c,'.')) if(strchr(str+c,'.'))
c+=strlen(str+c); c+=strlen(str+c);
else if(str[c]<'A'+(char)total && str[c]>='A') { else if(str[c]<'A'+(char)total && str[c]>='A') {
addtobatdl(bf[str[c]-'A']); addtobatdl(bf[str[c]-'A']);
} }
} }
if(ch=='D') if(ch=='D')
start_batch_download(); start_batch_download();
CRLF; CRLF;
return(2); return(2);
} }
clearline(); clearline();
continue; continue;
} }
if(ch=='E' || ch=='V') { /* Extended Info */ if(ch=='E' || ch=='V') { /* Extended Info */
if(total==1) { if(total==1) {
if(!viewfile(bf[0], ch=='E')) if(!viewfile(bf[0], ch=='E'))
return(-1); return(-1);
return(2); return(2);
} }
link_list_t saved_hotspots = mouse_hotspots; link_list_t saved_hotspots = mouse_hotspots;
ZERO_VAR(mouse_hotspots); ZERO_VAR(mouse_hotspots);
...@@ -600,22 +600,22 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -600,22 +600,22 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
for(i=0;i<total;i++) { for(i=0;i<total;i++) {
if(filematch(bf[i]->name, str+c)) { if(filematch(bf[i]->name, str+c)) {
if(!viewfile(bf[i], ch=='E')) if(!viewfile(bf[i], ch=='E'))
return(-1); return(-1);
} }
} }
} }
if(strchr(str+c,'.')) if(strchr(str+c,'.'))
c+=strlen(str+c); c+=strlen(str+c);
else if(str[c]<'A'+(char)total && str[c]>='A') { else if(str[c]<'A'+(char)total && str[c]>='A') {
if(!viewfile(bf[str[c]-'A'], ch=='E')) if(!viewfile(bf[str[c]-'A'], ch=='E'))
return(-1); return(-1);
} }
} }
cond_newline(); cond_newline();
return(2); return(2);
} }
clearline(); clearline();
continue; continue;
} }
if((ch=='R' || ch=='M') /* Delete or Move */ if((ch=='R' || ch=='M') /* Delete or Move */
...@@ -623,7 +623,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -623,7 +623,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
&& (dir_op(smb->dirnum) || useron.exempt&FLAG('R'))) { && (dir_op(smb->dirnum) || useron.exempt&FLAG('R'))) {
if(total==1) { if(total==1) {
strcpy(str,"A"); strcpy(str,"A");
d=1; d=1;
} }
else { else {
link_list_t saved_hotspots = mouse_hotspots; link_list_t saved_hotspots = mouse_hotspots;
...@@ -675,7 +675,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -675,7 +675,7 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
if(!md) if(!md)
md=usrdirs[ml]-1; md=usrdirs[ml]-1;
else md--; else md--;
CRLF; CRLF;
} }
lncntr=0; lncntr=0;
for(c=0;c<d;c++) { for(c=0;c<d;c++) {
...@@ -697,9 +697,9 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -697,9 +697,9 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
} }
} }
else if(ch=='M') else if(ch=='M')
movefile(smb, bf[i], usrdir[ml][md]); movefile(smb, bf[i], usrdir[ml][md]);
} }
} }
} }
if(strchr(str+c,'.')) if(strchr(str+c,'.'))
c+=strlen(str+c); c+=strlen(str+c);
...@@ -719,15 +719,15 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total ...@@ -719,15 +719,15 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total
else if(ch=='M') else if(ch=='M')
movefile(smb, f, usrdir[ml][md]); movefile(smb, f, usrdir[ml][md]);
} }
} }
} }
return(2); return(2);
} }
clearline(); clearline();
continue; continue;
} }
return(1); return(1);
} }
return(-1); return(-1);
...@@ -789,7 +789,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -789,7 +789,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
else action=NODE_LFIL; else action=NODE_LFIL;
if(msgabort()) { if(msgabort()) {
found=-1; found=-1;
break; break;
} }
m++; m++;
if(f->hdr.attr & MSG_DELETE) if(f->hdr.attr & MSG_DELETE)
...@@ -825,7 +825,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -825,7 +825,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
if(m) if(m)
m--; m--;
break; break;
} }
} }
else { else {
showfileinfo(f, /* show_extdesc: */mode != FI_DOWNLOAD); showfileinfo(f, /* show_extdesc: */mode != FI_DOWNLOAD);
...@@ -835,7 +835,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -835,7 +835,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
|| mode==FI_OFFLINE) { || mode==FI_OFFLINE) {
sync(); sync();
// CRLF; // CRLF;
SAFECOPY(str, "VDEQRN\r"); SAFEPRINTF(str, "VDERN\r%c", quit_key());
if(m > 1) if(m > 1)
SAFECAT(str, "P-\b"); SAFECAT(str, "P-\b");
if(dir_op(dirnum)) { if(dir_op(dirnum)) {
...@@ -848,7 +848,13 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -848,7 +848,13 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
} }
else else
mnemonics(text[UserRemoveFilePrompt]); mnemonics(text[UserRemoveFilePrompt]);
switch(getkeys(str,0)) { char key = getkeys(str, 0);
if(key == quit_key()) {
found=-1;
done=1;
break;
}
switch(key) {
case 'V': case 'V':
viewfilecontents(f); viewfilecontents(f);
CRLF; CRLF;
...@@ -878,7 +884,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -878,7 +884,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
errormsg(WHERE, ERR_REMOVE, path); errormsg(WHERE, ERR_REMOVE, path);
} else } else
lprintf(LOG_NOTICE, "deleted %s", path); lprintf(LOG_NOTICE, "deleted %s", path);
} }
} }
break; break;
case 'R': /* remove file from database */ case 'R': /* remove file from database */
...@@ -908,12 +914,12 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -908,12 +914,12 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
if(yesno(str)) { if(yesno(str)) {
f->dir = i; f->dir = i;
addfile(&cfg, f, f->extdesc, f->auxdata, /* client: */NULL); addfile(&cfg, f, f->extdesc, f->auxdata, /* client: */NULL);
} }
} }
} }
if(dir_op(dirnum) || stricmp(f->from, useron.alias)) { if(dir_op(dirnum) || stricmp(f->from, useron.alias)) {
if(noyes(text[RemoveCreditsQ])) if(noyes(text[RemoveCreditsQ]))
/* Fall through */ break; /* Fall through */ break;
} }
case 'C': /* remove credits only */ case 'C': /* remove credits only */
removefcdt(f); removefcdt(f);
...@@ -951,22 +957,20 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -951,22 +957,20 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
if(m) if(m)
m--; m--;
break; break;
case 'Q': /* quit */ }
found=-1;
done=1;
break;
}
} }
else if(mode==FI_DOWNLOAD || mode==FI_USERXFER) { else if(mode==FI_DOWNLOAD || mode==FI_USERXFER) {
char keys[128];
SAFEPRINTF(keys, "\r%c", quit_key());
getfilepath(&cfg, f, path); getfilepath(&cfg, f, path);
if(getfilesize(&cfg, f) < 1L) { /* getfilesize will set this to -1 if non-existant */ if(getfilesize(&cfg, f) < 1L) { /* getfilesize will set this to -1 if non-existant */
sync(); /* and 0 byte files shouldn't be d/led */ sync(); /* and 0 byte files shouldn't be d/led */
mnemonics(text[QuitOrNext]); mnemonics(text[QuitOrNext]);
if(getkeys("\rQ",0)=='Q') { if(getkeys(keys,0)==quit_key()) {
found=-1; found=-1;
break; break;
} }
continue; continue;
} }
if(!is_download_free(&cfg,f->dir,&useron,&client) if(!is_download_free(&cfg,f->dir,&useron,&client)
&& f->cost>user_available_credits(&useron)) { && f->cost>user_available_credits(&useron)) {
...@@ -974,21 +978,21 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -974,21 +978,21 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
bprintf(text[YouOnlyHaveNCredits] bprintf(text[YouOnlyHaveNCredits]
,u64toac(user_available_credits(&useron),tmp)); ,u64toac(user_available_credits(&useron),tmp));
mnemonics(text[QuitOrNext]); mnemonics(text[QuitOrNext]);
if(getkeys("\rQ",0)=='Q') { if(getkeys(keys,0)==quit_key()) {
found=-1; found=-1;
break; break;
} }
continue; continue;
} }
if(!can_user_download(&cfg, f->dir, &useron, &client, /* reason: */NULL)) { if(!can_user_download(&cfg, f->dir, &useron, &client, /* reason: */NULL)) {
sync(); sync();
bputs(text[CantDownloadFromDir]); bputs(text[CantDownloadFromDir]);
mnemonics(text[QuitOrNext]); mnemonics(text[QuitOrNext]);
if(getkeys("\rQ",0)=='Q') { if(getkeys(keys,0)==quit_key()) {
found=-1; found=-1;
break; break;
} }
continue; continue;
} }
if(!(cfg.dir[f->dir]->misc&DIR_TFREE) && gettimetodl(&cfg, f, cur_cps) > timeleft && !dir_op(dirnum) if(!(cfg.dir[f->dir]->misc&DIR_TFREE) && gettimetodl(&cfg, f, cur_cps) > timeleft && !dir_op(dirnum)
...@@ -996,11 +1000,21 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -996,11 +1000,21 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
sync(); sync();
bputs(text[NotEnoughTimeToDl]); bputs(text[NotEnoughTimeToDl]);
mnemonics(text[QuitOrNext]); mnemonics(text[QuitOrNext]);
if(getkeys("\rQ",0)=='Q') { if(getkeys(keys,0)==quit_key()) {
found=-1;
break;
}
continue;
}
if(batch_file_exists(&cfg, useron.number, XFER_BATCH_DOWNLOAD, f->name)) {
sync();
bprintf(text[FileAlreadyInQueue], f->name);
mnemonics(text[QuitOrNext]);
if(getkeys(keys,0)==quit_key()) {
found=-1; found=-1;
break; break;
} }
continue; continue;
} }
xfer_prot_menu(XFER_DOWNLOAD); xfer_prot_menu(XFER_DOWNLOAD);
sync(); sync();
...@@ -1017,12 +1031,12 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -1017,12 +1031,12 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
ch=(char)getkeys(str,0); ch=(char)getkeys(str,0);
if(ch==quit_key()) { if(ch==quit_key()) {
found=-1; found=-1;
done=1; done=1;
} }
else if(ch=='B') { else if(ch=='B') {
if(!addtobatdl(f)) { if(!addtobatdl(f)) {
break; break;
} }
} }
else if(ch == '\b' || ch == '-') { /* previous */ else if(ch == '\b' || ch == '-') { /* previous */
m--; m--;
...@@ -1048,7 +1062,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -1048,7 +1062,7 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
thisnode.aux=0xf0; thisnode.aux=0xf0;
putnodedat(cfg.node_num,&thisnode); putnodedat(cfg.node_num,&thisnode);
} }
CRLF; CRLF;
} }
for(j=0; j<cfg.total_dlevents; j++) { for(j=0; j<cfg.total_dlevents; j++) {
if(file_type_match(f->name, cfg.dlevent[j]->ext) if(file_type_match(f->name, cfg.dlevent[j]->ext)
...@@ -1066,15 +1080,15 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) ...@@ -1066,15 +1080,15 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode)
starttime+=elapsed; starttime+=elapsed;
if(checkprotresult(cfg.prot[i],error, f)) { if(checkprotresult(cfg.prot[i],error, f)) {
downloadedfile(f); downloadedfile(f);
downloadedbytes(f->size, elapsed); downloadedbytes(f->size, elapsed);
} else } else
notdownloaded(f->size, elapsed); notdownloaded(f->size, elapsed);
delfiles(cfg.temp_dir,ALLFILES); delfiles(cfg.temp_dir,ALLFILES);
autohangup(); autohangup();
} }
} }
} }
if(filespec[0] && !strchr(filespec,'*') && !strchr(filespec,'?')) if(filespec[0] && !strchr(filespec,'*') && !strchr(filespec,'?'))
break; break;
} }
freefiles(file_list, file_count); freefiles(file_list, file_count);
...@@ -1108,7 +1122,7 @@ int extdesclines(char *str) ...@@ -1108,7 +1122,7 @@ int extdesclines(char *str)
for(i=lc=last=0;str[i];i++) for(i=lc=last=0;str[i];i++)
if(str[i]==LF || i-last>LEN_FDESC) { if(str[i]==LF || i-last>LEN_FDESC) {
lc++; lc++;
last=i; last=i;
} }
return(lc); return(lc);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment