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 366b5d79 authored by rswindell's avatar rswindell

Converted six arrays of ulong/short for sub-board config/pointer data to a

single array of structures.
parent e8956512
......@@ -43,6 +43,15 @@
/* Called from function main */
/****************************************************************************/
void sbbs_t::getmsgptrs()
{
if(!useron.number)
return;
bputs(text[LoadingMsgPtrs]);
::getmsgptrs(&cfg,useron.number,subscan);
bputs(text[LoadedMsgPtrs]);
}
extern "C" BOOL DLLCALL getmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
{
char str[256];
uint i;
......@@ -50,53 +59,52 @@ void sbbs_t::getmsgptrs()
long length;
FILE *stream;
now=time(NULL);
if(!useron.number)
return;
bputs(text[LoadingMsgPtrs]);
sprintf(str,"%suser/ptrs/%4.4u.ixb", cfg.data_dir,useron.number);
if(!usernumber)
return(FALSE);
sprintf(str,"%suser/ptrs/%4.4u.ixb", cfg->data_dir,usernumber);
if((stream=fnopen(&file,str,O_RDONLY))==NULL) {
for(i=0;i<cfg.total_subs;i++) {
sub_ptr[i]=sav_sub_ptr[i]=0;
sub_last[i]=sav_sub_last[i]=0;
sub_cfg[i]=0;
if(cfg.sub[i]->misc&SUB_NSDEF)
sub_cfg[i]|=SUB_CFG_NSCAN;
if(cfg.sub[i]->misc&SUB_SSDEF)
sub_cfg[i]|=SUB_CFG_SSCAN;
sav_sub_cfg[i]=sub_cfg[i];
for(i=0;i<cfg->total_subs;i++) {
subscan[i].ptr=subscan[i].sav_ptr=0;
subscan[i].last=subscan[i].sav_last=0;
subscan[i].cfg=0;
if(cfg->sub[i]->misc&SUB_NSDEF)
subscan[i].cfg|=SUB_CFG_NSCAN;
if(cfg->sub[i]->misc&SUB_SSDEF)
subscan[i].cfg|=SUB_CFG_SSCAN;
subscan[i].sav_cfg=subscan[i].cfg;
}
bputs(text[LoadedMsgPtrs]);
return; }
return(TRUE);
}
length=filelength(file);
for(i=0;i<cfg.total_subs;i++) {
if(length<(cfg.sub[i]->ptridx+1)*10L) {
sub_ptr[i]=sub_last[i]=0L;
sub_cfg[i]=0;
if(cfg.sub[i]->misc&SUB_NSDEF)
sub_cfg[i]|=SUB_CFG_NSCAN;
if(cfg.sub[i]->misc&SUB_SSDEF)
sub_cfg[i]|=SUB_CFG_SSCAN;
for(i=0;i<cfg->total_subs;i++) {
if(length<(cfg->sub[i]->ptridx+1)*10L) {
subscan[i].ptr=subscan[i].last=0L;
subscan[i].cfg=0;
if(cfg->sub[i]->misc&SUB_NSDEF)
subscan[i].cfg|=SUB_CFG_NSCAN;
if(cfg->sub[i]->misc&SUB_SSDEF)
subscan[i].cfg|=SUB_CFG_SSCAN;
}
else {
fseek(stream,(long)cfg.sub[i]->ptridx*10L,SEEK_SET);
fread(&sub_ptr[i],4,1,stream);
fread(&sub_last[i],4,1,stream);
fread(&sub_cfg[i],2,1,stream);
fseek(stream,(long)cfg->sub[i]->ptridx*10L,SEEK_SET);
fread(&subscan[i].ptr,sizeof(long),1,stream);
fread(&subscan[i].last,sizeof(long),1,stream);
fread(&subscan[i].cfg,sizeof(short),1,stream);
}
sav_sub_ptr[i]=sub_ptr[i];
sav_sub_last[i]=sub_last[i];
sav_sub_cfg[i]=sub_cfg[i];
subscan[i].sav_ptr=subscan[i].ptr;
subscan[i].sav_last=subscan[i].last;
subscan[i].sav_cfg=subscan[i].cfg;
}
fclose(stream);
bputs(text[LoadedMsgPtrs]);
return(TRUE);
}
/****************************************************************************/
/* Writes to DATA\USER\PTRS\xxxx.DAB the msgptr array for the current user */
/* Called from functions main and newuser */
/****************************************************************************/
void sbbs_t::putmsgptrs()
extern "C" BOOL DLLCALL putmsgptrs(scfg_t* cfg, uint usernumber, subscan_t* subscan)
{
char str[256];
ushort idx,ch;
......@@ -104,43 +112,46 @@ void sbbs_t::putmsgptrs()
int file;
ulong l=0L,length;
if(!useron.number)
return;
sprintf(str,"%suser/ptrs/%4.4u.ixb", cfg.data_dir,useron.number);
if(!usernumber)
return(FALSE);
sprintf(str,"%suser/ptrs/%4.4u.ixb", cfg->data_dir,usernumber);
if((file=nopen(str,O_WRONLY|O_CREAT))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT);
return; }
return(FALSE);
}
length=filelength(file);
for(i=0;i<cfg.total_subs;i++) {
if(sav_sub_ptr[i]==sub_ptr[i] && sav_sub_last[i]==sub_last[i]
&& length>=((cfg.sub[i]->ptridx+1)*10UL)
&& sav_sub_cfg[i]==sub_cfg[i])
for(i=0;i<cfg->total_subs;i++) {
if(subscan[i].sav_ptr==subscan[i].ptr
&& subscan[i].sav_last==subscan[i].last
&& length>=((cfg->sub[i]->ptridx+1)*10UL)
&& subscan[i].sav_cfg==subscan[i].cfg)
continue;
while(filelength(file)<(long)(cfg.sub[i]->ptridx)*10) {
while(filelength(file)<(long)(cfg->sub[i]->ptridx)*10) {
lseek(file,0L,SEEK_END);
idx=tell(file)/10;
for(j=0;j<cfg.total_subs;j++)
if(cfg.sub[j]->ptridx==idx)
for(j=0;j<cfg->total_subs;j++)
if(cfg->sub[j]->ptridx==idx)
break;
write(file,&l,4);
write(file,&l,4);
write(file,&l,sizeof(long));
write(file,&l,sizeof(long));
ch=0xff; /* default to scan ON for new sub */
if(j<cfg.total_subs) {
if(!(cfg.sub[j]->misc&SUB_NSDEF))
if(j<cfg->total_subs) {
if(!(cfg->sub[j]->misc&SUB_NSDEF))
ch&=~SUB_CFG_NSCAN;
if(!(cfg.sub[j]->misc&SUB_SSDEF))
if(!(cfg->sub[j]->misc&SUB_SSDEF))
ch&=~SUB_CFG_SSCAN;
}
write(file,&ch,2);
write(file,&ch,sizeof(short));
}
lseek(file,(long)((long)(cfg.sub[i]->ptridx)*10),SEEK_SET);
write(file,&(sub_ptr[i]),4);
write(file,&(sub_last[i]),4);
write(file,&(sub_cfg[i]),2);
lseek(file,(long)((long)(cfg->sub[i]->ptridx)*10),SEEK_SET);
write(file,&(subscan[i].ptr),sizeof(long));
write(file,&(subscan[i].last),sizeof(long));
write(file,&(subscan[i].cfg),sizeof(short));
}
close(file);
if(!flength(str)) /* Don't leave 0 byte files */
remove(str);
return(TRUE);
}
/****************************************************************************/
......
......@@ -278,8 +278,8 @@ int sbbs_t::exec_msg(csi_t *csi)
return(0);
case CS_MSG_PTRS_REINIT:
for(i=0;i<cfg.total_subs;i++) {
sub_ptr[i]=sav_sub_ptr[i];
sub_last[i]=sav_sub_last[i];
subscan[i].ptr=subscan[i].sav_ptr;
subscan[i].last=subscan[i].sav_last;
}
bputs(text[MsgPtrsInitialized]);
return(0);
......
......@@ -1261,9 +1261,9 @@ void event_thread(void* arg)
,sbbs->cfg.data_dir,sbbs->cfg.qhub[i]->id);
file=sbbs->nopen(str,O_RDONLY);
for(j=0;j<sbbs->cfg.qhub[i]->subs;j++) {
sbbs->sub_ptr[sbbs->cfg.qhub[i]->sub[j]]=0;
lseek(file,sbbs->cfg.sub[sbbs->cfg.qhub[i]->sub[j]]->ptridx*4L,SEEK_SET);
read(file,&sbbs->sub_ptr[sbbs->cfg.qhub[i]->sub[j]],4);
sbbs->subscan[sbbs->cfg.qhub[i]->sub[j]].ptr=0;
lseek(file,sbbs->cfg.sub[sbbs->cfg.qhub[i]->sub[j]]->ptridx*sizeof(long),SEEK_SET);
read(file,&sbbs->subscan[sbbs->cfg.qhub[i]->sub[j]].ptr,sizeof(long));
}
if(file!=-1)
close(file);
......@@ -1275,8 +1275,10 @@ void event_thread(void* arg)
while(filelength(file)<
sbbs->cfg.sub[sbbs->cfg.qhub[i]->sub[j]]->ptridx*4L)
write(file,&l,4); /* initialize ptrs to null */
lseek(file,sbbs->cfg.sub[sbbs->cfg.qhub[i]->sub[j]]->ptridx*4L,SEEK_SET);
write(file,&sbbs->sub_ptr[sbbs->cfg.qhub[i]->sub[j]],4); }
lseek(file
,sbbs->cfg.sub[sbbs->cfg.qhub[i]->sub[j]]->ptridx*sizeof(long)
,SEEK_SET);
write(file,&sbbs->subscan[sbbs->cfg.qhub[i]->sub[j]].ptr,sizeof(long)); }
close(file); } }
sbbs->delfiles(sbbs->cfg.temp_dir,ALLFILES);
......@@ -1625,13 +1627,7 @@ sbbs_t::sbbs_t(ushort node_num, DWORD addr, char* name, SOCKET sd,
usrsubs=NULL;
usrsub=NULL;
sub_cfg=NULL;
sub_ptr=NULL;
sub_last=NULL;
sav_sub_cfg=NULL;
sav_sub_ptr=NULL;
sav_sub_last=NULL;
subscan=NULL;
curdir=NULL;
usrlib=NULL;
......@@ -1824,36 +1820,10 @@ bool sbbs_t::init()
return(false);
}
if((sub_cfg=(ushort *)MALLOC(sizeof(ushort)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "sub_cfg", sizeof(ushort)*cfg.total_subs);
return(false);
}
if((sub_ptr=(ulong *)MALLOC(sizeof(ulong)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "sub_ptr", sizeof(ulong)*cfg.total_subs);
return(false);
}
if((sub_last=(ulong *)MALLOC(sizeof(ulong)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "sub_last", sizeof(ulong)*cfg.total_subs);
return(false);
}
if((sav_sub_cfg=(ushort *)MALLOC(sizeof(ushort)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "sav_sub_cfg", sizeof(ushort)*cfg.total_subs);
return(false);
}
if((sav_sub_ptr=(ulong *)MALLOC(sizeof(ulong)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "sav_sub_ptr", sizeof(ulong)*cfg.total_subs);
if((subscan=(subscan_t *)MALLOC(sizeof(subscan_t)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "subscan", sizeof(subscan_t)*cfg.total_subs);
return(false);
}
if((sav_sub_last=(ulong *)MALLOC(sizeof(ulong)*cfg.total_subs))==NULL) {
errormsg(WHERE, ERR_ALLOC, "sav_sub_last", sizeof(ulong)*cfg.total_subs);
return(false);
}
}
......@@ -2075,13 +2045,7 @@ sbbs_t::~sbbs_t()
FREE_AND_NULL(usrgrp);
FREE_AND_NULL(usrsubs);
FREE_AND_NULL(usrsub);
FREE_AND_NULL(sub_cfg);
FREE_AND_NULL(sub_ptr);
FREE_AND_NULL(sub_last);
FREE_AND_NULL(sav_sub_cfg);
FREE_AND_NULL(sav_sub_ptr);
FREE_AND_NULL(sav_sub_last);
FREE_AND_NULL(subscan);
/* File Directory variables */
for(i=0;i<cfg.total_libs && usrdir!=NULL;i++)
......
......@@ -304,7 +304,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
/*********************/
for(i=0;i<usrgrps;i++) {
for(j=0;j<usrsubs[i] && !msgabort();j++) {
if(sub_cfg[usrsub[i][j]]&SUB_CFG_NSCAN
if(subscan[usrsub[i][j]].cfg&SUB_CFG_NSCAN
|| (!(useron.rest&FLAG('Q'))
&& cfg.sub[usrsub[i][j]]->misc&SUB_FORCED)) {
if(!chk_ar(cfg.sub[usrsub[i][j]]->read_ar,&useron))
......@@ -315,11 +315,11 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
subs_scanned++;
msgs=getlastmsg(usrsub[i][j],&lastmsg,0);
if(!msgs || lastmsg<=sub_ptr[usrsub[i][j]]) { /* no msgs */
if(sub_ptr[usrsub[i][j]]>lastmsg) { /* corrupted ptr */
if(!msgs || lastmsg<=subscan[usrsub[i][j]].ptr) { /* no msgs */
if(subscan[usrsub[i][j]].ptr>lastmsg) { /* corrupted ptr */
outchar('*');
sub_ptr[usrsub[i][j]]=lastmsg; /* so fix automatically */
sub_last[usrsub[i][j]]=lastmsg; }
subscan[usrsub[i][j]].ptr=lastmsg; /* so fix automatically */
subscan[usrsub[i][j]].last=lastmsg; }
bprintf(text[NScanStatusFmt]
,cfg.grp[cfg.sub[usrsub[i][j]]->grp]->sname
,cfg.sub[usrsub[i][j]]->lname,0L,msgs);
......@@ -335,9 +335,9 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
k=0;
if(useron.qwk&QWK_BYSELF)
k|=LP_BYSELF;
if(!(sub_cfg[usrsub[i][j]]&SUB_CFG_YSCAN))
if(!(subscan[usrsub[i][j]].cfg&SUB_CFG_YSCAN))
k|=LP_OTHERS;
post=loadposts(&posts,usrsub[i][j],sub_ptr[usrsub[i][j]],k);
post=loadposts(&posts,usrsub[i][j],subscan[usrsub[i][j]].ptr,k);
bprintf(text[NScanStatusFmt]
,cfg.grp[cfg.sub[usrsub[i][j]]->grp]->sname
......@@ -368,8 +368,8 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
for(l=0;l<posts && !msgabort();l++) {
bprintf("\b\b\b\b\b%-5lu",l+1);
sub_ptr[usrsub[i][j]]=post[l].number; /* set ptr */
sub_last[usrsub[i][j]]=post[l].number; /* set last read */
subscan[usrsub[i][j]].ptr=post[l].number; /* set ptr */
subscan[usrsub[i][j]].last=post[l].number; /* set last read */
msg.idx.offset=post[l].offset;
if(!loadmsg(&msg,post[l].number))
......
......@@ -129,10 +129,10 @@ bool sbbs_t::pack_rep(uint hubnum)
j=cfg.qhub[hubnum]->sub[i]; /* j now equals the real sub num */
msgs=getlastmsg(j,&last,0);
lncntr=0; /* defeat pause */
if(!msgs || last<=sub_ptr[j]) {
if(sub_ptr[j]>last) {
sub_ptr[j]=last;
sub_last[j]=last; }
if(!msgs || last<=subscan[j].ptr) {
if(subscan[j].ptr>last) {
subscan[j].ptr=last;
subscan[j].ptr=last; }
eprintf(remove_ctrl_a(text[NScanStatusFmt],tmp)
,cfg.grp[cfg.sub[j]->grp]->sname
,cfg.sub[j]->lname,0L,msgs);
......@@ -145,7 +145,7 @@ bool sbbs_t::pack_rep(uint hubnum)
errormsg(WHERE,ERR_OPEN,smb.file,k,smb.last_error);
continue; }
post=loadposts(&posts,j,sub_ptr[j],LP_BYSELF|LP_OTHERS|LP_PRIVATE|LP_REP);
post=loadposts(&posts,j,subscan[j].ptr,LP_BYSELF|LP_OTHERS|LP_PRIVATE|LP_REP);
eprintf(remove_ctrl_a(text[NScanStatusFmt],tmp)
,cfg.grp[cfg.sub[j]->grp]->sname
,cfg.sub[j]->lname,posts,msgs);
......@@ -153,7 +153,7 @@ bool sbbs_t::pack_rep(uint hubnum)
smb_close(&smb);
continue; }
sub_ptr[j]=last; /* set pointer */
subscan[j].ptr=last; /* set pointer */
eprintf("%s",remove_ctrl_a(text[QWKPackingSubboard],tmp)); /* ptr to last msg */
submsgs=0;
for(l=0;l<posts;l++) {
......
......@@ -388,16 +388,16 @@ void sbbs_t::qwk_sec()
int s;
uint i,k;
ulong msgcnt;
time_t *sav_ptr;
ulong *sav_ptr;
file_t fd;
getusrdirs();
fd.dir=cfg.total_dirs;
if((sav_ptr=(time_t *)MALLOC(sizeof(time_t)*cfg.total_subs))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(time_t)*cfg.total_subs);
if((sav_ptr=(ulong *)MALLOC(sizeof(ulong)*cfg.total_subs))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ulong)*cfg.total_subs);
return; }
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i];
sav_ptr[i]=subscan[i].ptr;
for(i=0;i<cfg.total_prots;i++)
if(cfg.prot[i]->bicmd[0] && chk_ar(cfg.prot[i]->ar,&useron))
bi++; /* number of bidirectional protocols configured */
......@@ -432,7 +432,7 @@ void sbbs_t::qwk_sec()
if(ch=='P') {
new_scan_ptr_cfg();
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i];
sav_ptr[i]=subscan[i].ptr;
delfiles(cfg.temp_dir,ALLFILES);
continue; }
if(ch=='C') {
......@@ -539,7 +539,7 @@ void sbbs_t::qwk_sec()
sprintf(str,"%s%s.qwk",cfg.temp_dir,cfg.sys_id);
if(!fexist(str) && !pack_qwk(str,&msgcnt,0)) {
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i];
subscan[i].ptr=sav_ptr[i];
remove(str);
last_ns_time=ns_time;
continue; }
......@@ -554,7 +554,7 @@ void sbbs_t::qwk_sec()
ch=(char)getkeys(tmp2,0);
if(ch=='Q' || sys_status&SS_ABORT) {
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; /* re-load saved pointers */
subscan[i].ptr=sav_ptr[i]; /* re-load saved pointers */
last_ns_time=ns_time;
continue; }
for(i=0;i<cfg.total_prots;i++)
......@@ -584,20 +584,20 @@ void sbbs_t::qwk_sec()
logline("D!",AttemptedToDownloadQWKpacket);
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; } /* re-load saved pointers */
subscan[i].ptr=sav_ptr[i]; } /* re-load saved pointers */
else {
qwk_success(msgcnt,1,0);
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i]; } }
sav_ptr[i]=subscan[i].ptr; } }
else if(error) {
logline("D!",AttemptedToDownloadQWKpacket);
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; }
subscan[i].ptr=sav_ptr[i]; }
else {
qwk_success(msgcnt,1,0);
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i]; }
sav_ptr[i]=subscan[i].ptr; }
sprintf(str,"%s%s.qwk",cfg.temp_dir,cfg.sys_id);
remove(str);
unpack_rep();
......@@ -607,13 +607,13 @@ void sbbs_t::qwk_sec()
else {
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; } }
subscan[i].ptr=sav_ptr[i]; } }
else if(ch=='D') { /* Download QWK Packet of new messages */
sprintf(str,"%s%s.qwk",cfg.temp_dir,cfg.sys_id);
if(!fexist(str) && !pack_qwk(str,&msgcnt,0)) {
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i];
subscan[i].ptr=sav_ptr[i];
last_ns_time=ns_time;
remove(str);
continue; }
......@@ -621,7 +621,7 @@ void sbbs_t::qwk_sec()
bputs(text[EnterPath]);
if(!getstr(str,60,K_LINE|K_UPPER)) {
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; /* re-load saved pointers */
subscan[i].ptr=sav_ptr[i]; /* re-load saved pointers */
last_ns_time=ns_time;
continue; }
backslashcolon(str);
......@@ -635,18 +635,18 @@ void sbbs_t::qwk_sec()
bputs(text[FileAlreadyThere]);
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i];
subscan[i].ptr=sav_ptr[i];
continue; } }
sprintf(tmp,"%s%s.qwk",cfg.temp_dir,cfg.sys_id);
if(mv(tmp,tmp2,0)) { /* unsuccessful */
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i];
subscan[i].ptr=sav_ptr[i];
last_ns_time=ns_time; }
else {
bprintf(text[FileNBytesSent],tmp2,ultoac(flength(tmp2),tmp));
qwk_success(msgcnt,0,0);
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i]; }
sav_ptr[i]=subscan[i].ptr; }
continue; }
/***************/
......@@ -663,7 +663,7 @@ void sbbs_t::qwk_sec()
ch=(char)getkeys(tmp2,0);
if(ch=='Q' || sys_status&SS_ABORT) {
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; /* re-load saved pointers */
subscan[i].ptr=sav_ptr[i]; /* re-load saved pointers */
last_ns_time=ns_time;
continue; }
for(i=0;i<cfg.total_prots;i++)
......@@ -679,24 +679,24 @@ void sbbs_t::qwk_sec()
if(!checkprotlog(&fd)) {
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; } /* re-load saved pointers */
subscan[i].ptr=sav_ptr[i]; } /* re-load saved pointers */
else {
qwk_success(msgcnt,0,0);
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i]; } }
sav_ptr[i]=subscan[i].ptr; } }
else if(error) {
logline("D!",AttemptedToDownloadQWKpacket);
last_ns_time=ns_time;
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i]; }
subscan[i].ptr=sav_ptr[i]; }
else {
qwk_success(msgcnt,0,0);
for(i=0;i<cfg.total_subs;i++)
sav_ptr[i]=sub_ptr[i]; }
sav_ptr[i]=subscan[i].ptr; }
autohangup(); }
else { /* if not valid protocol (hungup?) */
for(i=0;i<cfg.total_subs;i++)
sub_ptr[i]=sav_ptr[i];
subscan[i].ptr=sav_ptr[i];
last_ns_time=ns_time; } }
else if(ch=='U') { /* Upload REP Packet */
......@@ -766,19 +766,19 @@ void sbbs_t::qwksetptr(uint subnum, char *buf, int reset)
if(buf[2]=='/' && buf[5]=='/') { /* date specified */
l=dstrtounix(&cfg,buf);
sub_ptr[subnum]=getmsgnum(subnum,l);
subscan[subnum].ptr=getmsgnum(subnum,l);
return; }
l=atol(buf);
if(l>=0) /* ptr specified */
sub_ptr[subnum]=l;
subscan[subnum].ptr=l;
else if(l) { /* relative ptr specified */
getlastmsg(subnum,&last,0);
if(-l>(long)last)
sub_ptr[subnum]=0;
subscan[subnum].ptr=0;
else
sub_ptr[subnum]=last+l; }
subscan[subnum].ptr=last+l; }
else if(reset)
getlastmsg(subnum,&sub_ptr[subnum],0);
getlastmsg(subnum,&(subscan[subnum].ptr),0);
}
......@@ -804,7 +804,7 @@ void sbbs_t::qwkcfgline(char *buf,uint subnum)
if(!strncmp(str,"DROP ",5)) { /* Drop from new-scan */
l=atol(str+5);
if(!l)
sub_cfg[subnum]&=~SUB_CFG_NSCAN;
subscan[subnum].cfg&=~SUB_CFG_NSCAN;
else {
x=l/1000;
y=l-(x*1000);
......@@ -813,22 +813,22 @@ void sbbs_t::qwkcfgline(char *buf,uint subnum)
sprintf(str,"Invalid conference number %lu",l);
logline("Q!",str); }
else
sub_cfg[usrsub[x][y]]&=~SUB_CFG_NSCAN; }
subscan[usrsub[x][y]].cfg&=~SUB_CFG_NSCAN; }
return; }
if(!strncmp(str,"ADD YOURS ",10)) { /* Add to new-scan */
sub_cfg[subnum]|=(SUB_CFG_NSCAN|SUB_CFG_YSCAN);
subscan[subnum].cfg|=(SUB_CFG_NSCAN|SUB_CFG_YSCAN);
qwksetptr(subnum,str+10,0);
return; }
else if(!strncmp(str,"YOURS ",6)) {
sub_cfg[subnum]|=(SUB_CFG_NSCAN|SUB_CFG_YSCAN);
subscan[subnum].cfg|=(SUB_CFG_NSCAN|SUB_CFG_YSCAN);
qwksetptr(subnum,str+6,0);
return; }
else if(!strncmp(str,"ADD ",4)) { /* Add to new-scan */
sub_cfg[subnum]|=SUB_CFG_NSCAN;
sub_cfg[subnum]&=~SUB_CFG_YSCAN;
subscan[subnum].cfg|=SUB_CFG_NSCAN;
subscan[subnum].cfg&=~SUB_CFG_YSCAN;
qwksetptr(subnum,str+4,0);
return; }
......@@ -844,13 +844,13 @@ void sbbs_t::qwkcfgline(char *buf,uint subnum)
if(!strncmp(str,"RESETALL ",9)) { /* set all ptrs */
for(x=0;x<usrgrps;x++)
for(y=0;y<usrsubs[x];y++)