Skip to content
Snippets Groups Projects
Commit 8587927d authored by rswindell's avatar rswindell
Browse files

Log output fix / enhancement:

When importing QWK messages (e.g. from a QWKnet packet), the statistics logged:
  "Imported n QWK msgs in x seconds (y msgs/sec)"
would logged for all but the last conference (sub-board) being imported into.
Log the import statistics at the end of the import process if a sub-board is
currently open and messages were imported.
Also, log a message when importing QWK netmail.
Thanks to Mark Lewis' eagle-eye, noticing the total messages imported didn't
match all the stats log messages total.
parent ff5837b4
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,16 @@ ...@@ -36,6 +36,16 @@
#include "sbbs.h" #include "sbbs.h"
#include "qwk.h" #include "qwk.h"
static void log_qwk_import_stats(ulong msgs, time_t start)
{
if(msgs) {
time_t t = time(NULL) - start;
if(t < 1)
t = 1;
eprintf(LOG_INFO,"Imported %lu QWK messages in %lu seconds (%lu msgs/sec)", msgs, (ulong)t, (ulong)(msgs/t));
}
}
/****************************************************************************/ /****************************************************************************/
/* Unpacks .QWK packet, hubnum is the number of the QWK net hub */ /* Unpacks .QWK packet, hubnum is the number of the QWK net hub */
/****************************************************************************/ /****************************************************************************/
...@@ -252,6 +262,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) ...@@ -252,6 +262,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
} }
smb_unlocksmbhdr(&smb); smb_unlocksmbhdr(&smb);
if(qwk_import_msg(qwk, (char *)block, blocks, hubnum+1, &smb, usernum, &msg)) { if(qwk_import_msg(qwk, (char *)block, blocks, hubnum+1, &smb, usernum, &msg)) {
eprintf(LOG_INFO,"Imported QWK mail message from %s to %s #%u", msg.from, msg.to, usernum);
SAFEPRINTF(str,text[UserSentYouMail],msg.from); SAFEPRINTF(str,text[UserSentYouMail],msg.from);
putsmsg(&cfg,usernum,str); putsmsg(&cfg,usernum,str);
tmsgs++; tmsgs++;
...@@ -278,12 +289,8 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) ...@@ -278,12 +289,8 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
if(j!=lastsub) { if(j!=lastsub) {
if(msgs) { if(lastsub != INVALID_SUB)
t=(ulong)(time(NULL)-startsub); log_qwk_import_stats(msgs, startsub);
if(t<1)
t=1;
eprintf(LOG_INFO,"Imported %lu QWK msgs in %lu seconds (%lu msgs/sec)", msgs,t,msgs/t);
}
msgs=0; msgs=0;
startsub=time(NULL); startsub=time(NULL);
...@@ -331,6 +338,10 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) ...@@ -331,6 +338,10 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
tmsgs++; tmsgs++;
} }
} }
if(lastsub != INVALID_SUB) {
log_qwk_import_stats(msgs, startsub);
smb_close(&smb);
}
qwk_handle_remaining_votes(&voting, NET_QWK, cfg.qhub[hubnum]->id, hubnum); qwk_handle_remaining_votes(&voting, NET_QWK, cfg.qhub[hubnum]->id, hubnum);
...@@ -347,9 +358,6 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) ...@@ -347,9 +358,6 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
strListFree(&subject_can); strListFree(&subject_can);
strListFree(&twit_list); strListFree(&twit_list);
if(lastsub!=INVALID_SUB)
smb_close(&smb);
delfiles(cfg.temp_dir,"*.NDX"); delfiles(cfg.temp_dir,"*.NDX");
SAFEPRINTF(str,"%sMESSAGES.DAT",cfg.temp_dir); SAFEPRINTF(str,"%sMESSAGES.DAT",cfg.temp_dir);
removecase(str); removecase(str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment