Commit 2ffc5ee1 authored by rswindell's avatar rswindell
Browse files

Added 3 new user event types: POST, UPLOAD, and DOWNLOAD.

parent 3e7754c8
...@@ -494,6 +494,9 @@ var EVENT_LOGON =1 /* Execute during logon sequence */ ...@@ -494,6 +494,9 @@ var EVENT_LOGON =1 /* Execute during logon sequence */
var EVENT_LOGOFF =2 /* Execute during logoff sequence */ var EVENT_LOGOFF =2 /* Execute during logoff sequence */
var EVENT_NEWUSER =3 /* Execute during newuser app. */ var EVENT_NEWUSER =3 /* Execute during newuser app. */
var EVENT_BIRTHDAY=4 /* Execute on birthday */ var EVENT_BIRTHDAY=4 /* Execute on birthday */
var EVENT_POST =5 /* Execute after message posted */
var EVENT_UPLOAD =6 /* Execute after file uploaded */
var EVENT_DOWNLOAD=7 /* Execute after file downloaded */
/********************************************/ /********************************************/
/********************************************/ /********************************************/
......
...@@ -180,6 +180,9 @@ ...@@ -180,6 +180,9 @@
!define EVENT_NEWUSER 2 # Execute during newuser app. !define EVENT_NEWUSER 2 # Execute during newuser app.
!define EVENT_BIRTHDAY 3 # Execute on birthday !define EVENT_BIRTHDAY 3 # Execute on birthday
!define EVENT_LOGOFF 4 # Execute during normal logoff !define EVENT_LOGOFF 4 # Execute during normal logoff
!define EVENT_POST 5 # Execute after message posted
!define EVENT_UPLOAD 6 # Execute after file uploaded
!define EVENT_DOWNLOAD 7 # Execute after file downloaded
!define TG_ECHO .0 # Turn on telnet echo !define TG_ECHO .0 # Turn on telnet echo
!define TG_CRLF .1 # Expand sole CR to CRLF !define TG_CRLF .1 # Expand sole CR to CRLF
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -103,23 +103,28 @@ void sbbs_t::downloadfile(file_t* f) ...@@ -103,23 +103,28 @@ void sbbs_t::downloadfile(file_t* f)
sprintf(str,"%s%s.ixb",cfg.dir[f->dir]->data_dir,cfg.dir[f->dir]->code); sprintf(str,"%s%s.ixb",cfg.dir[f->dir]->data_dir,cfg.dir[f->dir]->code);
if((file=nopen(str,O_RDWR))==-1) { if((file=nopen(str,O_RDWR))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDWR); errormsg(WHERE,ERR_OPEN,str,O_RDWR);
return; } return;
}
length=filelength(file); length=filelength(file);
if(length%F_IXBSIZE) { if(length%F_IXBSIZE) {
close(file); close(file);
errormsg(WHERE,ERR_LEN,str,length); errormsg(WHERE,ERR_LEN,str,length);
return; } return;
}
strcpy(fname,f->name); strcpy(fname,f->name);
for(i=8;i<12;i++) /* Turn FILENAME.EXT into FILENAMEEXT */ for(i=8;i<12;i++) /* Turn FILENAME.EXT into FILENAMEEXT */
fname[i]=fname[i+1]; fname[i]=fname[i+1];
for(l=0;l<(ulong)length;l+=F_IXBSIZE) { for(l=0;l<(ulong)length;l+=F_IXBSIZE) {
read(file,str,F_IXBSIZE); /* Look for the filename in the IXB file */ read(file,str,F_IXBSIZE); /* Look for the filename in the IXB file */
str[11]=0; str[11]=0;
if(!strcmp(fname,str)) break; } if(!strcmp(fname,str))
break;
}
if(l>=(ulong)length) { if(l>=(ulong)length) {
close(file); close(file);
errormsg(WHERE,ERR_CHK,f->name,0); errormsg(WHERE,ERR_CHK,f->name,0);
return; } return;
}
lseek(file,l+18,SEEK_SET); lseek(file,l+18,SEEK_SET);
write(file,&f->datedled,4); /* Write the current time stamp for datedled */ write(file,&f->datedled,4); /* Write the current time stamp for datedled */
close(file); close(file);
...@@ -140,6 +145,8 @@ void sbbs_t::downloadfile(file_t* f) ...@@ -140,6 +145,8 @@ void sbbs_t::downloadfile(file_t* f)
removefiledat(&cfg,f); removefiledat(&cfg,f);
} }
} }
user_event(EVENT_DOWNLOAD);
} }
/****************************************************************************/ /****************************************************************************/
...@@ -161,7 +168,8 @@ void sbbs_t::notdownloaded(ulong size, time_t start, time_t end) ...@@ -161,7 +168,8 @@ void sbbs_t::notdownloaded(ulong size, time_t start, time_t end)
sprintf(str,"Possible use of leech protocol (leech=%u downloads=%u)" sprintf(str,"Possible use of leech protocol (leech=%u downloads=%u)"
,useron.leech+1,useron.dls); ,useron.leech+1,useron.dls);
errorlog(str); errorlog(str);
useron.leech=(uchar)adjustuserrec(&cfg,useron.number,U_LEECH,2,1); } useron.leech=(uchar)adjustuserrec(&cfg,useron.number,U_LEECH,2,1);
}
} }
...@@ -183,7 +191,8 @@ int sbbs_t::protocol(char *cmdline, bool cd) ...@@ -183,7 +191,8 @@ int sbbs_t::protocol(char *cmdline, bool cd)
autohang=yesno(text[HangUpAfterXferQ]); autohang=yesno(text[HangUpAfterXferQ]);
if(sys_status&SS_ABORT) { /* if ctrl-c */ if(sys_status&SS_ABORT) { /* if ctrl-c */
autohang=0; autohang=0;
return(-1); } return(-1);
}
bputs(text[StartXferNow]); bputs(text[StartXferNow]);
RIOSYNC(0); RIOSYNC(0);
//lprintf("%s",cmdline); //lprintf("%s",cmdline);
...@@ -261,16 +270,22 @@ void sbbs_t::autohangup() ...@@ -261,16 +270,22 @@ void sbbs_t::autohangup()
while((k=inkey(K_NONE,DELAY_AUTOHG))!=0 && online) { while((k=inkey(K_NONE,DELAY_AUTOHG))!=0 && online) {
if(toupper(k)=='H') { if(toupper(k)=='H') {
c=0; c=0;
break; } break;
}
if(toupper(k)=='A') { if(toupper(k)=='A') {
a=1; a=1;
break; } } break;
}
}
if(!a) { if(!a) {
outchar(BS); outchar(BS);
outchar(BS); } } outchar(BS);
}
}
if(c==-1) { if(c==-1) {
bputs(text[Disconnected]); bputs(text[Disconnected]);
hangup(); } hangup();
}
else else
CRLF; CRLF;
} }
...@@ -301,7 +316,8 @@ bool sbbs_t::checkprotlog(file_t* f) ...@@ -301,7 +316,8 @@ bool sbbs_t::checkprotlog(file_t* f)
sprintf(str,"%s attempted to download attached file: %s" sprintf(str,"%s attempted to download attached file: %s"
,useron.alias,f->name); ,useron.alias,f->name);
logline("D!",str); logline("D!",str);
return(0); } return(0);
}
unpadfname(f->name,tmp); unpadfname(f->name,tmp);
if(tmp[strlen(tmp)-1]=='.') /* DSZ log uses FILE instead of FILE. */ if(tmp[strlen(tmp)-1]=='.') /* DSZ log uses FILE instead of FILE. */
tmp[strlen(tmp)-1]=0; /* when there isn't an extension. */ tmp[strlen(tmp)-1]=0; /* when there isn't an extension. */
...@@ -317,7 +333,9 @@ bool sbbs_t::checkprotlog(file_t* f) ...@@ -317,7 +333,9 @@ bool sbbs_t::checkprotlog(file_t* f)
if(str[0]=='E' || str[0]=='L' || (str[6]==SP && str[7]=='0')) if(str[0]=='E' || str[0]=='L' || (str[6]==SP && str[7]=='0'))
break; /* E for Error or L for Lost Carrier */ break; /* E for Error or L for Lost Carrier */
fclose(stream); /* or only sent 0 bytes! */ fclose(stream); /* or only sent 0 bytes! */
return(true); } } return(true);
}
}
fclose(stream); fclose(stream);
bprintf(text[FileNotSent],f->name); bprintf(text[FileNotSent],f->name);
if(f->dir<cfg.total_dirs) if(f->dir<cfg.total_dirs)
...@@ -367,11 +385,13 @@ void sbbs_t::seqwait(uint devnum) ...@@ -367,11 +385,13 @@ void sbbs_t::seqwait(uint devnum)
thisnode.action=NODE_RFSD; thisnode.action=NODE_RFSD;
thisnode.aux=devnum; thisnode.aux=devnum;
putnodedat(cfg.node_num,&thisnode); /* write devnum, unlock, and ret */ putnodedat(cfg.node_num,&thisnode); /* write devnum, unlock, and ret */
return; } return;
}
putnodedat(cfg.node_num,&thisnode); putnodedat(cfg.node_num,&thisnode);
if(!loop) if(!loop)
bprintf(text[WaitingForDeviceN],devnum); bprintf(text[WaitingForDeviceN],devnum);
loop=1; loop=1;
mswait(100); } mswait(100);
}
} }
...@@ -392,6 +392,8 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) ...@@ -392,6 +392,8 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode)
signal_sub_sem(&cfg,subnum); signal_sub_sem(&cfg,subnum);
user_event(EVENT_POST);
return(true); return(true);
} }
......
...@@ -362,6 +362,9 @@ typedef enum { /* Values for xtrn_t.event */ ...@@ -362,6 +362,9 @@ typedef enum { /* Values for xtrn_t.event */
,EVENT_LOGOFF /* Execute during logoff sequence */ ,EVENT_LOGOFF /* Execute during logoff sequence */
,EVENT_NEWUSER /* Execute during newuser app. */ ,EVENT_NEWUSER /* Execute during newuser app. */
,EVENT_BIRTHDAY /* Execute on birthday */ ,EVENT_BIRTHDAY /* Execute on birthday */
,EVENT_POST /* Execute after posting a message */
,EVENT_UPLOAD /* Execute after uploading a file */
,EVENT_DOWNLOAD /* Execute after downloading a file */
} user_event_t; } user_event_t;
/* Misc bits for event_t.misc */ /* Misc bits for event_t.misc */
......
...@@ -872,9 +872,19 @@ online program name. ...@@ -872,9 +872,19 @@ online program name.
case EVENT_BIRTHDAY: case EVENT_BIRTHDAY:
strcpy(str,"Birthday"); strcpy(str,"Birthday");
break; break;
case EVENT_POST:
strcpy(str,"Message Posted");
break;
case EVENT_UPLOAD:
strcpy(str,"File Uploaded");
break;
case EVENT_DOWNLOAD:
strcpy(str,"File Downloaded");
break;
default: default:
strcpy(str,"No"); strcpy(str,"No");
break; } break;
}
if(cfg.xtrn[i]->misc&EVENTONLY && cfg.xtrn[i]->event) if(cfg.xtrn[i]->misc&EVENTONLY && cfg.xtrn[i]->event)
strcat(str,", Only"); strcat(str,", Only");
sprintf(opt[k++],"%-27.27s%s","Execute on Event",str); sprintf(opt[k++],"%-27.27s%s","Execute on Event",str);
...@@ -1135,23 +1145,11 @@ modify the data of users who run the program, set this option to Yes. ...@@ -1135,23 +1145,11 @@ modify the data of users who run the program, set this option to Yes.
strcpy(opt[k++],"Logoff"); strcpy(opt[k++],"Logoff");
strcpy(opt[k++],"New User"); strcpy(opt[k++],"New User");
strcpy(opt[k++],"Birthday"); strcpy(opt[k++],"Birthday");
strcpy(opt[k++],"Message Posted");
strcpy(opt[k++],"File Uploaded");
strcpy(opt[k++],"File Downloaded");
opt[k][0]=0; opt[k][0]=0;
switch(cfg.xtrn[i]->event) { k=cfg.xtrn[i]->event;
default:
k=0;
break;
case EVENT_LOGON:
k=1;
break;
case EVENT_LOGOFF:
k=2;
break;
case EVENT_NEWUSER:
k=3;
break;
case EVENT_BIRTHDAY:
k=4;
break; }
SETHELP(WHERE); SETHELP(WHERE);
/* /*
Execute Online Program on Event: Execute Online Program on Event:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -402,6 +402,8 @@ bool sbbs_t::unpack_rep(char* repfile) ...@@ -402,6 +402,8 @@ bool sbbs_t::unpack_rep(char* repfile)
,useron.alias,cfg.grp[cfg.sub[n]->grp]->sname,cfg.sub[n]->lname); ,useron.alias,cfg.grp[cfg.sub[n]->grp]->sname,cfg.sub[n]->lname);
signal_sub_sem(&cfg,n); signal_sub_sem(&cfg,n);
logline("P+",str); logline("P+",str);
if(!(useron.rest&FLAG('Q')))
user_event(EVENT_POST);
} /* end of public message */ } /* end of public message */
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -59,7 +59,8 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -59,7 +59,8 @@ bool sbbs_t::uploadfile(file_t *f)
curdirnum=f->dir; curdirnum=f->dir;
if(findfile(&cfg,f->dir,f->name)) { if(findfile(&cfg,f->dir,f->name)) {
errormsg(WHERE,ERR_CHK,f->name,f->dir); errormsg(WHERE,ERR_CHK,f->name,f->dir);
return(0); } return(0);
}
sprintf(path,"%s%s",f->altpath>0 && f->altpath<=cfg.altpaths sprintf(path,"%s%s",f->altpath>0 && f->altpath<=cfg.altpaths
? cfg.altpath[f->altpath-1] ? cfg.altpath[f->altpath-1]
: cfg.dir[f->dir]->path,unpadfname(f->name,fname)); : cfg.dir[f->dir]->path,unpadfname(f->name,fname));
...@@ -73,7 +74,8 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -73,7 +74,8 @@ bool sbbs_t::uploadfile(file_t *f)
,f->name ,f->name
,cfg.lib[cfg.dir[f->dir]->lib]->sname,cfg.dir[f->dir]->sname); ,cfg.lib[cfg.dir[f->dir]->lib]->sname,cfg.dir[f->dir]->sname);
logline("U!",str); logline("U!",str);
return(0); } return(0);
}
strcpy(tmp,f->name); strcpy(tmp,f->name);
truncsp(tmp); truncsp(tmp);
for(i=0;i<cfg.total_ftests;i++) for(i=0;i<cfg.total_ftests;i++)
...@@ -90,23 +92,26 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -90,23 +92,26 @@ bool sbbs_t::uploadfile(file_t *f)
sprintf(str,"%ssbbsfile.nam",cfg.node_dir); sprintf(str,"%ssbbsfile.nam",cfg.node_dir);
if((stream=fopen(str,"w"))!=NULL) { if((stream=fopen(str,"w"))!=NULL) {
fwrite(fname,1,strlen(fname),stream); fwrite(fname,1,strlen(fname),stream);
fclose(stream); } fclose(stream);
}
sprintf(str,"%ssbbsfile.des",cfg.node_dir); sprintf(str,"%ssbbsfile.des",cfg.node_dir);
if((stream=fopen(str,"w"))!=NULL) { if((stream=fopen(str,"w"))!=NULL) {
fwrite(f->desc,1,strlen(f->desc),stream); fwrite(f->desc,1,strlen(f->desc),stream);
fclose(stream); } fclose(stream);
}
if(external(cmdstr(cfg.ftest[i]->cmd,path,f->desc,NULL),EX_OFFLINE)) { if(external(cmdstr(cfg.ftest[i]->cmd,path,f->desc,NULL),EX_OFFLINE)) {
bprintf(text[FileHadErrors],f->name,cfg.ftest[i]->ext); bprintf(text[FileHadErrors],f->name,cfg.ftest[i]->ext);
if(SYSOP) { if(SYSOP) {
if(!yesno(text[DeleteFileQ])) return(0); } if(!yesno(text[DeleteFileQ])) return(0);
}
remove(path); remove(path);
sprintf(str,"%s attempted to upload %s to %s %s (%s Errors)" sprintf(str,"%s attempted to upload %s to %s %s (%s Errors)"
,useron.alias ,useron.alias
,f->name ,f->name
,cfg.lib[cfg.dir[f->dir]->lib]->sname,cfg.dir[f->dir]->sname,cfg.ftest[i]->ext); ,cfg.lib[cfg.dir[f->dir]->lib]->sname,cfg.dir[f->dir]->sname,cfg.ftest[i]->ext);
logline("U!",str); logline("U!",str);
return(0); } return(0);
else { } else {
sprintf(str,"%ssbbsfile.nam",cfg.node_dir); sprintf(str,"%ssbbsfile.nam",cfg.node_dir);
if((stream=fopen(str,"r"))!=NULL) { if((stream=fopen(str,"r"))!=NULL) {
if(fgets(str,128,stream)) { if(fgets(str,128,stream)) {
...@@ -116,16 +121,21 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -116,16 +121,21 @@ bool sbbs_t::uploadfile(file_t *f)
truncsp(tmp); truncsp(tmp);
sprintf(path,"%s%s",f->altpath>0 && f->altpath<=cfg.altpaths sprintf(path,"%s%s",f->altpath>0 && f->altpath<=cfg.altpaths
? cfg.altpath[f->altpath-1] : cfg.dir[f->dir]->path ? cfg.altpath[f->altpath-1] : cfg.dir[f->dir]->path
,unpadfname(f->name,fname)); } ,unpadfname(f->name,fname));
}
fclose(stream); fclose(stream);
} }
sprintf(str,"%ssbbsfile.des",cfg.node_dir); sprintf(str,"%ssbbsfile.des",cfg.node_dir);
if((stream=fopen(str,"r"))!=NULL) { if((stream=fopen(str,"r"))!=NULL) {
if(fgets(str,128,stream)) { if(fgets(str,128,stream)) {
truncsp(str); truncsp(str);
sprintf(f->desc,"%.*s",LEN_FDESC,str); } sprintf(f->desc,"%.*s",LEN_FDESC,str);
fclose(stream); } }
CRLF; } } fclose(stream);
}
CRLF;
}
}
if((length=flength(path))<=0L) { if((length=flength(path))<=0L) {
bprintf(text[FileZeroLength],f->name); bprintf(text[FileZeroLength],f->name);
...@@ -135,7 +145,8 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -135,7 +145,8 @@ bool sbbs_t::uploadfile(file_t *f)
,f->name ,f->name
,cfg.lib[cfg.dir[f->dir]->lib]->sname,cfg.dir[f->dir]->sname); ,cfg.lib[cfg.dir[f->dir]->lib]->sname,cfg.dir[f->dir]->sname);
logline("U!",str); logline("U!",str);
return(0); } return(0);
}
if(cfg.dir[f->dir]->misc&DIR_DIZ) { if(cfg.dir[f->dir]->misc&DIR_DIZ) {
for(i=0;i<cfg.total_fextrs;i++) for(i=0;i<cfg.total_fextrs;i++)
if(!stricmp(cfg.fextr[i]->ext,tmp+9) && chk_ar(cfg.fextr[i]->ar,&useron)) if(!stricmp(cfg.fextr[i]->ext,tmp+9) && chk_ar(cfg.fextr[i]->ar,&useron))
...@@ -166,10 +177,14 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -166,10 +177,14 @@ bool sbbs_t::uploadfile(file_t *f)
for(i=0;desc[i];i++) for(i=0;desc[i];i++)
if(isalnum(desc[i])) if(isalnum(desc[i]))
break; break;
sprintf(f->desc,"%.*s",LEN_FDESC,desc+i); } sprintf(f->desc,"%.*s",LEN_FDESC,desc+i);
}
close(file); close(file);
remove(str); remove(str);
f->misc|=FM_EXTDESC; } } } f->misc|=FM_EXTDESC;
}
}
}
logon_ulb+=length; /* Update 'this call' stats */ logon_ulb+=length; /* Update 'this call' stats */
logon_uls++; logon_uls++;
...@@ -208,7 +223,10 @@ bool sbbs_t::uploadfile(file_t *f) ...@@ -208,7 +223,10 @@ bool sbbs_t::uploadfile(file_t *f)
,((ulong)(length*(cfg.dir[f->dir]->up_pct/100.0))/cur_cps)/60); ,((ulong)(length*(cfg.dir[f->dir]->up_pct/100.0))/cur_cps)/60);
else else
useron.cdt=adjustuserrec(&cfg,useron.number,U_CDT,10 useron.cdt=adjustuserrec(&cfg,useron.number,U_CDT,10
,(ulong)(f->cdt*(cfg.dir[f->dir]->up_pct/100.0))); } ,(ulong)(f->cdt*(cfg.dir[f->dir]->up_pct/100.0)));
}
user_event(EVENT_UPLOAD);
return(true); return(true);
} }
...@@ -291,16 +309,19 @@ bool sbbs_t::upload(uint dirnum) ...@@ -291,16 +309,19 @@ bool sbbs_t::upload(uint dirnum)
if(fexistcase(str)) { /* File is on disk */ if(fexistcase(str)) { /* File is on disk */
if(!dir_op(dirnum) && online!=ON_LOCAL) { /* local users or sysops */ if(!dir_op(dirnum) && online!=ON_LOCAL) { /* local users or sysops */
bprintf(text[FileAlreadyThere],fname); bprintf(text[FileAlreadyThere],fname);
return(false); } return(false);
}
if(!yesno(text[FileOnDiskAddQ])) if(!yesno(text[FileOnDiskAddQ]))
return(false); } return(false);
}
else if(online==ON_LOCAL) { else if(online==ON_LOCAL) {
bputs(text[FileNotOnDisk]); bputs(text[FileNotOnDisk]);
bputs(text[EnterPath]); bputs(text[EnterPath]);
if(!getstr(tmp,60,K_LINE)) if(!getstr(tmp,60,K_LINE))
return(false); return(false);
backslash(tmp); backslash(tmp);
sprintf(src,"%s%s",tmp,fname); } sprintf(src,"%s%s",tmp,fname);
}
strcpy(str,cfg.dir[dirnum]->exts); strcpy(str,cfg.dir[dirnum]->exts);
strcpy(tmp,f.name); strcpy(tmp,f.name);
truncsp(tmp); truncsp(tmp);
...@@ -311,14 +332,16 @@ bool sbbs_t::upload(uint dirnum) ...@@ -311,14 +332,16 @@ bool sbbs_t::upload(uint dirnum)
*p=0; *p=0;
ch=strlen(str+i); ch=strlen(str+i);
if(!strcmp(tmp+9,str+i)) if(!strcmp(tmp+9,str+i))
break; } break;
}
if(j && i>=j) { if(j && i>=j) {
bputs(text[TheseFileExtsOnly]); bputs(text[TheseFileExtsOnly]);
bputs(cfg.dir[dirnum]->exts); bputs(cfg.dir[dirnum]->exts);
CRLF; CRLF;
if(!dir_op(dirnum)) return(false); } if(!dir_op(dirnum)) return(false);
}
bputs(text[SearchingForDupes]); bputs(text[SearchingForDupes]);
for(i=k=0;i<usrlibs;i++) for(i=k=0;i<usrlibs;i++) {
for(j=0;j<usrdirs[i];j++,k++) { for(j=0;j<usrdirs[i];j++,k++) {
outchar('.'); outchar('.');
if(k && !(k%5)) if(k && !(k%5))
...@@ -330,7 +353,10 @@ bool sbbs_t::upload(uint dirnum) ...@@ -330,7 +353,10 @@ bool sbbs_t::upload(uint dirnum)
if(!dir_op(dirnum)) if(!dir_op(dirnum))
return(false); /* File is in database for another dir */ return(false); /* File is in database for another dir */
if(usrdir[i][j]==dirnum) if(usrdir[i][j]==dirnum)
return(false); } } /* don't allow duplicates */ return(false); /* don't allow duplicates */
}
}
}
bputs(text[SearchedForDupes]); bputs(text[SearchedForDupes]);
if(dirnum==cfg.user_dir) { /* User to User transfer */ if(dirnum==cfg.user_dir) { /* User to User transfer */
bputs(text[EnterAfterLastDestUser]); bputs(text[EnterAfterLastDestUser]);
...@@ -341,25 +367,32 @@ bool sbbs_t::upload(uint dirnum) ...@@ -341,25 +367,32 @@ bool sbbs_t::upload(uint dirnum)
if((user.number=finduser(str))!=0) { if((user.number=finduser(str))!=0) {
if(!dir_op(dirnum) && user.number==useron.number) { if(!dir_op(dirnum) && user.number==useron.number) {
bputs(text[CantSendYourselfFiles]); bputs(text[CantSendYourselfFiles]);
continue; } continue;
}