From 8587927d50436df9e468d65a786ae3614560d3a1 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 3 Jul 2019 20:27:19 +0000 Subject: [PATCH] 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. --- src/sbbs3/un_qwk.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/sbbs3/un_qwk.cpp b/src/sbbs3/un_qwk.cpp index bda0bcf3e6..29b06d7ba1 100644 --- a/src/sbbs3/un_qwk.cpp +++ b/src/sbbs3/un_qwk.cpp @@ -36,6 +36,16 @@ #include "sbbs.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 */ /****************************************************************************/ @@ -252,6 +262,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) } smb_unlocksmbhdr(&smb); 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); putsmsg(&cfg,usernum,str); tmsgs++; @@ -278,12 +289,8 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) if(j!=lastsub) { - if(msgs) { - t=(ulong)(time(NULL)-startsub); - if(t<1) - t=1; - eprintf(LOG_INFO,"Imported %lu QWK msgs in %lu seconds (%lu msgs/sec)", msgs,t,msgs/t); - } + if(lastsub != INVALID_SUB) + log_qwk_import_stats(msgs, startsub); msgs=0; startsub=time(NULL); @@ -331,6 +338,10 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) 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); @@ -347,9 +358,6 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum) strListFree(&subject_can); strListFree(&twit_list); - if(lastsub!=INVALID_SUB) - smb_close(&smb); - delfiles(cfg.temp_dir,"*.NDX"); SAFEPRINTF(str,"%sMESSAGES.DAT",cfg.temp_dir); removecase(str); -- GitLab