From b5013e2956c55b3a44d9295a1ea974d073974122 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 29 Dec 2004 10:17:45 +0000
Subject: [PATCH] smb_addmsg() now does the msg.idx initialization for us.

---
 src/sbbs3/qwktomsg.cpp | 28 ++++++----------------------
 src/sbbs3/sbbsecho.c   | 11 +----------
 2 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/src/sbbs3/qwktomsg.cpp b/src/sbbs3/qwktomsg.cpp
index d32b1bee3f..68294ca86e 100644
--- a/src/sbbs3/qwktomsg.cpp
+++ b/src/sbbs3/qwktomsg.cpp
@@ -70,23 +70,21 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
 
 	if(subnum!=INVALID_SUB
 		&& (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)
-		msg.idx.attr|=MSG_ANONYMOUS;
+		msg.hdr.attr|=MSG_ANONYMOUS;
 	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')) &&
 		(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]
 		&& 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
 		&& sub_op(subnum))
-		msg.idx.attr|=MSG_PERMANENT;
-
-	msg.hdr.attr=msg.idx.attr;
+		msg.hdr.attr|=MSG_PERMANENT;
 
 	memset(&tm,0,sizeof(tm));
 	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
 		/* duplicate message-IDs must be allowed in mail database */
 		dupechk_hashes&=~(1<<SMB_HASH_SOURCE_MSG_ID);
 
-		msg.idx.to=touser;
-
 		username(&cfg,touser,str);
 		smb_hfield_str(&msg,RECIPIENT,str);
 		sprintf(str,"%u",touser);
@@ -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 */
 		truncsp(str);
 		smb_hfield_str(&msg,RECIPIENT,str);
-		strlwr(str);
-		msg.idx.to=crc16(str,0); 
 		if(cfg.sub[subnum]->misc&SUB_LZH)
 			xlat=XLAT_LZH;
 	}
@@ -143,7 +137,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
 	sprintf(str,"%25.25s",hdrblk+71);   /* Subject */
 	truncsp(str);
 	smb_hfield_str(&msg,SUBJECT,str);
-	msg.idx.subj=smb_subject_crc(str);
 
 	/********************************/
 	/* Convert the QWK message text */
@@ -299,15 +292,6 @@ bool sbbs_t::qwktomsg(FILE *qwk_fp, char *hdrblk, char fromhub, uint subnum
 			strcpy(str,useron.alias);
 	}
 	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(!fromhub)
diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c
index 69aba83ddc..2dc573fc26 100644
--- a/src/sbbs3/sbbsecho.c
+++ b/src/sbbs3/sbbsecho.c
@@ -2315,23 +2315,14 @@ int fmsgtosmsg(uchar* fbuf, fmsghdr_t fmsghdr, uint user, uint subnum)
 	destaddr.point=fmsghdr.destpoint;
 
 	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);
-	strlwr(fmsghdr.to);
-	msg.idx.to=crc16(fmsghdr.to,0);
 
 	if(user) {
 		sprintf(str,"%u",user);
 		smb_hfield_str(&msg,RECIPIENTEXT,str);
-		msg.idx.to=user; }
+	}
 
 	smb_hfield_str(&msg,SUBJECT,fmsghdr.subj);
-	msg.idx.subj=smb_subject_crc(fmsghdr.subj);
 
 	if(fbuf==NULL) {
 		printf("ERROR allocating fbuf\n");
-- 
GitLab