Skip to content
Snippets Groups Projects
Commit 142c6753 authored by rswindell's avatar rswindell
Browse files

For offline QWK packet creation (daily pre-pack or FTP downloads):

1. check if user is online before starting any scanning/packing
2. log a message when aborting scan/pack due to user online
parent 0f143ff6
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,6 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
ulong subs_scanned=0;
float f; /* Sparky is responsible */
time_t start;
node_t node;
mail_t *mail;
post_t *post;
glob_t g;
......@@ -72,8 +71,13 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
const char* fmode;
ex=EX_STDOUT;
if(prepack)
if(prepack) {
ex|=EX_OFFLINE;
if(is_user_online(&cfg, useron.number)) { /* Don't pre-pack with user online */
eprintf(LOG_NOTICE, "User #%u is concurrently logged-in, QWK packet creation aborted", useron.number);
return(false);
}
}
delfiles(cfg.temp_dir,ALLFILES);
SAFEPRINTF2(str,"%sfile/%04u.qwk",cfg.data_dir,useron.number);
......@@ -120,8 +124,10 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
}
now=time(NULL);
if(localtime_r(&now,&tm)==NULL)
if(localtime_r(&now,&tm)==NULL) {
errormsg(WHERE, ERR_CHK, "time", (ulong)now);
return(false);
}
fprintf(stream,"%s\r\n%s\r\n%s\r\n%s, Sysop\r\n0000,%s\r\n"
"%02u-%02u-%u,%02u:%02u:%02u\r\n"
......@@ -709,14 +715,10 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
}
if(prepack) {
for(i=1;i<=cfg.sys_nodes;i++) {
getnodedat(i,&node,0);
if((node.status==NODE_INUSE || node.status==NODE_QUIET
|| node.status==NODE_LOGON) && node.useron==useron.number)
break;
}
if(i<=cfg.sys_nodes) /* Don't pre-pack with user online */
if(is_user_online(&cfg, useron.number)) { /* Don't pre-pack with user online */
eprintf(LOG_NOTICE, "User #%u is concurrently logged-in, QWK packet creation aborted", useron.number);
return(false);
}
}
/*******************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment