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

smb_addmsg() now does the msg.idx initialization for us.

parent 86652976
No related branches found
No related tags found
No related merge requests found
...@@ -70,23 +70,21 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum ...@@ -70,23 +70,21 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
if(subnum!=INVALID_SUB if(subnum!=INVALID_SUB
&& (hdrblk[0]=='*' || hdrblk[0]=='+' || cfg.sub[subnum]->misc&SUB_PONLY)) && (hdrblk[0]=='*' || hdrblk[0]=='+' || cfg.sub[subnum]->misc&SUB_PONLY))
msg.idx.attr|=MSG_PRIVATE; msg.hdr.attr|=MSG_PRIVATE;
if(subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_AONLY) if(subnum!=INVALID_SUB && cfg.sub[subnum]->misc&SUB_AONLY)
msg.idx.attr|=MSG_ANONYMOUS; msg.hdr.attr|=MSG_ANONYMOUS;
if(subnum==INVALID_SUB && cfg.sys_misc&SM_DELREADM) if(subnum==INVALID_SUB && cfg.sys_misc&SM_DELREADM)
msg.idx.attr|=MSG_KILLREAD; msg.hdr.attr|=MSG_KILLREAD;
if((fromhub || useron.rest&FLAG('Q')) && if((fromhub || useron.rest&FLAG('Q')) &&
(hdrblk[0]=='*' || hdrblk[0]=='-' || hdrblk[0]=='`')) (hdrblk[0]=='*' || hdrblk[0]=='-' || hdrblk[0]=='`'))
msg.idx.attr|=MSG_READ; msg.hdr.attr|=MSG_READ;
if(subnum!=INVALID_SUB && !fromhub && cfg.sub[subnum]->mod_ar[0] if(subnum!=INVALID_SUB && !fromhub && cfg.sub[subnum]->mod_ar[0]
&& chk_ar(cfg.sub[subnum]->mod_ar,&useron)) && chk_ar(cfg.sub[subnum]->mod_ar,&useron))
msg.idx.attr|=MSG_MODERATED; msg.hdr.attr|=MSG_MODERATED;
if(subnum!=INVALID_SUB && !fromhub && cfg.sub[subnum]->misc&SUB_SYSPERM if(subnum!=INVALID_SUB && !fromhub && cfg.sub[subnum]->misc&SUB_SYSPERM
&& sub_op(subnum)) && sub_op(subnum))
msg.idx.attr|=MSG_PERMANENT; msg.hdr.attr|=MSG_PERMANENT;
msg.hdr.attr=msg.idx.attr;
memset(&tm,0,sizeof(tm)); memset(&tm,0,sizeof(tm));
tm.tm_mon = ((hdrblk[8]&0xf)*10)+(hdrblk[9]&0xf); tm.tm_mon = ((hdrblk[8]&0xf)*10)+(hdrblk[9]&0xf);
...@@ -116,8 +114,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum ...@@ -116,8 +114,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
/* duplicate message-IDs must be allowed in mail database */ /* duplicate message-IDs must be allowed in mail database */
dupechk_hashes&=~(1<<SMB_HASH_SOURCE_MSG_ID); dupechk_hashes&=~(1<<SMB_HASH_SOURCE_MSG_ID);
msg.idx.to=touser;
username(&cfg,touser,str); username(&cfg,touser,str);
smb_hfield_str(&msg,RECIPIENT,str); smb_hfield_str(&msg,RECIPIENT,str);
sprintf(str,"%u",touser); sprintf(str,"%u",touser);
...@@ -134,8 +130,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum ...@@ -134,8 +130,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
sprintf(str,"%25.25s",(char *)hdrblk+21); /* To user */ sprintf(str,"%25.25s",(char *)hdrblk+21); /* To user */
truncsp(str); truncsp(str);
smb_hfield_str(&msg,RECIPIENT,str); smb_hfield_str(&msg,RECIPIENT,str);
strlwr(str);
msg.idx.to=crc16(str,0);
if(cfg.sub[subnum]->misc&SUB_LZH) if(cfg.sub[subnum]->misc&SUB_LZH)
xlat=XLAT_LZH; xlat=XLAT_LZH;
} }
...@@ -143,7 +137,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum ...@@ -143,7 +137,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
sprintf(str,"%25.25s",hdrblk+71); /* Subject */ sprintf(str,"%25.25s",hdrblk+71); /* Subject */
truncsp(str); truncsp(str);
smb_hfield_str(&msg,SUBJECT,str); smb_hfield_str(&msg,SUBJECT,str);
msg.idx.subj=smb_subject_crc(str);
/********************************/ /********************************/
/* Convert the QWK message text */ /* Convert the QWK message text */
...@@ -299,15 +292,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum ...@@ -299,15 +292,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
strcpy(str,useron.alias); strcpy(str,useron.alias);
} }
smb_hfield_str(&msg,SENDER,str); smb_hfield_str(&msg,SENDER,str);
if((uint)subnum==INVALID_SUB) {
if(useron.rest&FLAG('Q') || fromhub)
msg.idx.from=0;
else
msg.idx.from=useron.number;
} else {
strlwr(str);
msg.idx.from=crc16(str,0);
}
if(!strnicmp(header+skip,"@MSGID:",7)) { if(!strnicmp(header+skip,"@MSGID:",7)) {
if(!fromhub) if(!fromhub)
......
...@@ -2315,23 +2315,14 @@ int fmsgtosmsg(uchar* fbuf, fmsghdr_t fmsghdr, uint user, uint subnum) ...@@ -2315,23 +2315,14 @@ int fmsgtosmsg(uchar* fbuf, fmsghdr_t fmsghdr, uint user, uint subnum)
destaddr.point=fmsghdr.destpoint; destaddr.point=fmsghdr.destpoint;
smb_hfield_str(&msg,SENDER,fmsghdr.from); smb_hfield_str(&msg,SENDER,fmsghdr.from);
strlwr(fmsghdr.from);
if(subnum==INVALID_SUB)
msg.idx.from=0;
else
msg.idx.from=crc16(fmsghdr.from,0);
smb_hfield_str(&msg,RECIPIENT,fmsghdr.to); smb_hfield_str(&msg,RECIPIENT,fmsghdr.to);
strlwr(fmsghdr.to);
msg.idx.to=crc16(fmsghdr.to,0);
if(user) { if(user) {
sprintf(str,"%u",user); sprintf(str,"%u",user);
smb_hfield_str(&msg,RECIPIENTEXT,str); smb_hfield_str(&msg,RECIPIENTEXT,str);
msg.idx.to=user; } }
smb_hfield_str(&msg,SUBJECT,fmsghdr.subj); smb_hfield_str(&msg,SUBJECT,fmsghdr.subj);
msg.idx.subj=smb_subject_crc(fmsghdr.subj);
if(fbuf==NULL) { if(fbuf==NULL) {
printf("ERROR allocating fbuf\n"); printf("ERROR allocating fbuf\n");
......
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