diff --git a/src/sbbs3/un_qwk.cpp b/src/sbbs3/un_qwk.cpp index bda0bcf3e6451fb3a09b583957dd230e51a6b160..29b06d7ba1633ac202d48d647a383c03b22f996f 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);