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 784b4be4 authored by rswindell's avatar rswindell

Pass an smb_t* to QWK msg import and export functions rather than a subnum

since the smb_t already contains a subnum and we were passing a pointer to the
sbbs_t::smb to lower-level called-functions anyway.
Let's not mix-up class-scope with function arguments.
parent 296e28cc
......@@ -43,7 +43,7 @@
/* mode determines how to handle Ctrl-A codes */
/* Returns the number of bytes used for the body-text (multiple of 128) */
/****************************************************************************/
ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, smb_t* smb
, int conf, FILE* hdrs, FILE* voting)
{
char str[512],from[512],to[512],ch=0,tear=0,tearwatch=0,*buf,*p;
......@@ -57,6 +57,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
struct tm tm;
smbmsg_t remsg;
time_t tt;
uint subnum = smb->subnum;
get_msgid(&cfg, subnum, msg, msgid, sizeof(msgid));
offset=(long)ftell(qwk_fp);
......@@ -96,7 +97,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
}
if(msg->subj && *msg->subj)
fprintf(voting, "%s: %s\n",smb_hfieldtype(SUBJECT), msg->subj);
if((p = get_replyid(&cfg, &smb, msg, reply_id, sizeof(reply_id))) != NULL)
if((p = get_replyid(&cfg, smb, msg, reply_id, sizeof(reply_id))) != NULL)
fprintf(voting, "%s: %s\n", smb_hfieldtype(RFC822REPLYID), p);
/* Time/Date/Zone info */
fprintf(voting,"WhenWritten: %-20s %04hx\n"
......@@ -119,7 +120,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
/* Message-IDs */
fprintf(hdrs,"%s: %s\n", smb_hfieldtype(RFC822MSGID), msgid);
if((p = get_replyid(&cfg, &smb, msg, reply_id, sizeof(reply_id))) != NULL)
if((p = get_replyid(&cfg, smb, msg, reply_id, sizeof(reply_id))) != NULL)
fprintf(hdrs, "%s: %s\n", smb_hfieldtype(RFC822REPLYID), p);
/* Time/Date/Zone info */
......@@ -295,8 +296,8 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
} else if(msg->hdr.thread_back) {
memset(&remsg,0,sizeof(remsg));
remsg.hdr.number=msg->hdr.thread_back;
if(smb_getmsgidx(&smb, &remsg))
size+=fprintf(qwk_fp,"@REPLY: <%s>%c",smb.last_error,QWK_NEWLINE);
if(smb_getmsgidx(smb, &remsg))
size+=fprintf(qwk_fp,"@REPLY: <%s>%c",smb->last_error,QWK_NEWLINE);
else
size+=fprintf(qwk_fp,"@REPLY: %s%c"
,get_msgid(&cfg,subnum,&remsg,msgid,sizeof(msgid))
......@@ -325,7 +326,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
ulong getmsgtxt_mode = GETMSGTXT_ALL;
if(!(mode&QM_TO_QNET)) // Get just the plain-text portion of MIME-encoded messages
getmsgtxt_mode |= GETMSGTXT_PLAIN;
buf=smb_getmsgtxt(&smb, msg, getmsgtxt_mode);
buf=smb_getmsgtxt(smb, msg, getmsgtxt_mode);
if(!buf)
return(0);
......
......@@ -387,7 +387,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
mv(str,tmp,/* copy: */TRUE);
}
size=msgtoqwk(&msg,qwk,mode|QM_REPLYTO,INVALID_SUB,0,hdrs);
size=msgtoqwk(&msg, qwk, mode|QM_REPLYTO, &smb, /* confnum: */0, hdrs);
smb_unlockmsghdr(&smb,&msg);
smb_freemsgmem(&msg);
if(ndx && size) {
......@@ -527,7 +527,7 @@ bool sbbs_t::pack_qwk(char *packet, ulong *msgcnt, bool prepack)
else
mode&=~(QM_TAGLINE|QM_TO_QNET);
size=msgtoqwk(&msg,qwk,mode,usrsub[i][j],conf,hdrs,voting);
size=msgtoqwk(&msg, qwk, mode, &smb, conf, hdrs, voting);
smb_unlockmsghdr(&smb,&msg);
if(ndx && size) {
......
......@@ -152,7 +152,7 @@ bool sbbs_t::pack_rep(uint hubnum)
mode |= (cfg.qhub[hubnum]->misc&(QHUB_EXT|QHUB_CTRL_A));
/* For an unclear reason, kludge lines (including @VIA and @TZ) were not included in NetMail previously */
if(!(cfg.qhub[hubnum]->misc&QHUB_NOHEADERS)) mode|=(QM_VIA|QM_TZ|QM_MSGID|QM_REPLYTO);
msgtoqwk(&msg, rep, mode, INVALID_SUB, 0, hdrs);
msgtoqwk(&msg, rep, mode, &smb, /* confnum: */0, hdrs);
packedmail++;
smb_unlockmsghdr(&smb,&msg);
smb_freemsgmem(&msg);
......@@ -228,7 +228,7 @@ bool sbbs_t::pack_rep(uint hubnum)
if(msg.from_net.type!=NET_QWK)
mode|=QM_TAGLINE;
msgtoqwk(&msg,rep,mode,j,cfg.qhub[hubnum]->conf[i],hdrs,voting);
msgtoqwk(&msg, rep, mode, &smb, cfg.qhub[hubnum]->conf[i], hdrs, voting);
smb_freemsgmem(&msg);
smb_unlockmsghdr(&smb,&msg);
......
......@@ -215,7 +215,7 @@ void sbbs_t::qwk_new_msg(ulong confnum, smbmsg_t* msg, char* hdrblk, long offset
/* Does *not* free the msgmem */
/****************************************************************************/
bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
,char fromhub, uint subnum
,char fromhub, smb_t* smb
,uint touser, smbmsg_t* msg)
{
char* body;
......@@ -230,6 +230,7 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
ushort xlat=XLAT_NONE;
long dupechk_hashes=SMB_HASH_SOURCE_DUPE;
str_list_t kludges;
uint subnum = smb->subnum;
if(subnum!=INVALID_SUB
&& (hdrblk[0]=='*' || hdrblk[0]=='+' || cfg.sub[subnum]->misc&SUB_PONLY))
......@@ -459,29 +460,29 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
if(online==ON_REMOTE)
bputs(text[WritingIndx]);
if(smb.status.max_crcs==0) /* no CRC checking means no body text dupe checking */
if(smb->status.max_crcs==0) /* no CRC checking means no body text dupe checking */
dupechk_hashes&=~(1<<SMB_HASH_SOURCE_BODY);
add_msg_ids(&cfg, &smb, msg, /* remsg: */NULL);
if((i=smb_addmsg(&smb,msg,smb_storage_mode(&cfg, &smb),dupechk_hashes,xlat,(uchar*)body,(uchar*)tail))==SMB_SUCCESS)
add_msg_ids(&cfg, smb, msg, /* remsg: */NULL);
if((i=smb_addmsg(smb,msg,smb_storage_mode(&cfg, smb),dupechk_hashes,xlat,(uchar*)body,(uchar*)tail))==SMB_SUCCESS)
success=true;
else if(i==SMB_DUPE_MSG) {
bprintf("\r\n!%s\r\n",smb.last_error);
bprintf("\r\n!%s\r\n",smb->last_error);
if(!fromhub) {
if(subnum==INVALID_SUB) {
SAFEPRINTF(str,"duplicate e-mail attempt (%s)", smb.last_error);
SAFEPRINTF(str,"duplicate e-mail attempt (%s)", smb->last_error);
logline(LOG_NOTICE,"E!",str);
} else {
SAFEPRINTF3(str,"duplicate message attempt in %s %s (%s)"
,cfg.grp[cfg.sub[subnum]->grp]->sname
,cfg.sub[subnum]->lname
,smb.last_error);
,smb->last_error);
logline(LOG_NOTICE,"P!",str);
}
}
}
else
errormsg(WHERE,ERR_WRITE,smb.file,i,smb.last_error);
errormsg(WHERE,ERR_WRITE,smb->file,i,smb->last_error);
free(body);
free(tail);
......
......@@ -973,11 +973,11 @@ public:
bool unpack_rep(char* repfile=NULL);
/* msgtoqwk.cpp */
ulong msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum, int conf, FILE* hdrs_dat, FILE* voting_dat = NULL);
ulong msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, smb_t*, int conf, FILE* hdrs_dat, FILE* voting_dat = NULL);
/* qwktomsg.cpp */
void qwk_new_msg(ulong confnum, smbmsg_t* msg, char* hdrblk, long offset, str_list_t headers, bool parse_sender_hfields);
bool qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks, char fromhub, uint subnum
bool qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks, char fromhub, smb_t*
,uint touser, smbmsg_t* msg);
/* fido.cpp */
......
......@@ -251,7 +251,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
continue;
}
smb_unlocksmbhdr(&smb);
if(qwk_import_msg(qwk,(char *)block,blocks,hubnum+1,INVALID_SUB,usernum,&msg)) {
if(qwk_import_msg(qwk, (char *)block, blocks, hubnum+1, &smb, usernum, &msg)) {
SAFEPRINTF(str,text[UserSentYouMail],msg.from);
putsmsg(&cfg,usernum,str);
tmsgs++;
......@@ -325,7 +325,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
lastsub=j;
}
if(qwk_import_msg(qwk,(char *)block,blocks,hubnum+1,/*subnum: */j,/*touser: */0,&msg)) {
if(qwk_import_msg(qwk, (char *)block, blocks, hubnum+1, &smb, /*touser: */0, &msg)) {
signal_sub_sem(&cfg,j);
msgs++;
tmsgs++;
......
......@@ -344,7 +344,7 @@ bool sbbs_t::unpack_rep(char* repfile)
smb_unlocksmbhdr(&smb);
if(qwk_import_msg(rep, block, blocks
,/* fromhub: */0,/* subnum: */INVALID_SUB,/* touser: */usernum,&msg)) {
,/* fromhub: */0, &smb, /* touser: */usernum, &msg)) {
if(usernum==1) {
useron.fbacks++;
......@@ -533,7 +533,7 @@ bool sbbs_t::unpack_rep(char* repfile)
}
if(qwk_import_msg(rep, block, blocks
,/* fromhub: */0,/* subnum: */n,/* touser: */0,&msg)) {
,/* fromhub: */0, &smb, /* touser: */0, &msg)) {
logon_posts++;
user_posted_msg(&cfg, &useron, 1);
if(online == ON_REMOTE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment