Commit 4be8e46c authored by rswindell's avatar rswindell
Browse files

Define and use SMB_HASH_SOURCE_DUPE, which doesn't include the message SUBJECT

(subjects can/should not be used for dupe message checking).
parent 4b50691f
......@@ -344,10 +344,10 @@ int main(int argc, char **argv)
if(!(smb.status.attr&SMB_EMAIL) && chkhash) {
/* Look-up the message hashes */
hashes=smb_msghashes(&msg,body,SMB_HASH_SOURCE_ALL);
hashes=smb_msghashes(&msg,body,SMB_HASH_SOURCE_DUPE);
if(hashes!=NULL
&& hashes[0]!=NULL
&& (i=smb_findhash(&smb,hashes,NULL,SMB_HASH_SOURCE_ALL,/* mark */TRUE ))
&& (i=smb_findhash(&smb,hashes,NULL,SMB_HASH_SOURCE_DUPE,/* mark */TRUE ))
!=SMB_SUCCESS) {
for(h=0;hashes[h]!=NULL;h++) {
if(hashes[h]->flags&SMB_HASH_MARKED)
......
......@@ -425,7 +425,7 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t*
ushort xlat=XLAT_NONE;
int i;
int storage=SMB_SELFPACK;
long dupechk_hashes=SMB_HASH_SOURCE_ALL;
long dupechk_hashes=SMB_HASH_SOURCE_DUPE;
if(msg==NULL)
return(SMB_FAILURE);
......
......@@ -221,7 +221,7 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks
uint16_t net_type;
ushort xlat=XLAT_NONE;
int storage=SMB_SELFPACK;
long dupechk_hashes=SMB_HASH_SOURCE_ALL;
long dupechk_hashes=SMB_HASH_SOURCE_DUPE;
if(subnum!=INVALID_SUB
&& (hdrblk[0]=='*' || hdrblk[0]=='+' || cfg.sub[subnum]->misc&SUB_PONLY))
......
......@@ -2236,7 +2236,7 @@ int fmsgtosmsg(uchar* fbuf, fmsghdr_t fmsghdr, uint user, uint subnum)
ushort xlat=XLAT_NONE,net;
ulong l,m,length,bodylen,taillen,crc;
ulong save;
long dupechk_hashes=SMB_HASH_SOURCE_ALL;
long dupechk_hashes=SMB_HASH_SOURCE_DUPE;
faddr_t faddr,origaddr,destaddr;
smb_t* smbfile;
char fname[MAX_PATH+1];
......
......@@ -183,7 +183,7 @@ void postmsg(char type, char* to, char* to_number, char* to_address,
int i;
ushort agent=AGENT_SMBUTIL;
smbmsg_t msg;
long dupechk_hashes=SMB_HASH_SOURCE_ALL;
long dupechk_hashes=SMB_HASH_SOURCE_DUPE;
/* Read message text from stream (file or stdin) */
msgtxtlen=0;
......
......@@ -85,7 +85,7 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash
msg->hdr.number=smb->status.last_msg+1;
if(!(smb->status.attr&(SMB_EMAIL|SMB_NOHASH))) {
hashes=smb_msghashes(msg,body,SMB_HASH_SOURCE_ALL);
hashes=smb_msghashes(msg,body,SMB_HASH_SOURCE_DUPE);
if(smb_findhash(smb, hashes, &found, dupechk_hashes, /* mark? */FALSE)==SMB_SUCCESS) {
safe_snprintf(smb->last_error,sizeof(smb->last_error)
......
......@@ -469,6 +469,7 @@ enum {
#define SMB_HASH_SOURCE_MASK 0x1f
#define SMB_HASH_SOURCE_NONE 0
#define SMB_HASH_SOURCE_ALL 0xff
#define SMB_HASH_SOURCE_DUPE ((1<<SMB_HASH_SOURCE_BODY)|(1<<SMB_HASH_SOURCE_MSG_ID)|(1<<SMB_HASH_SOURCE_FTN_ID))
typedef struct _PACK {
......
......@@ -289,9 +289,9 @@ int SMBCALL smb_hashmsg(smb_t* smb, smbmsg_t* msg, const uchar* text, BOOL updat
if(smb->status.attr&(SMB_EMAIL|SMB_NOHASH))
return(SMB_SUCCESS);
hashes=smb_msghashes(msg,text,SMB_HASH_SOURCE_ALL);
hashes=smb_msghashes(msg,text,SMB_HASH_SOURCE_DUPE);
if(smb_findhash(smb, hashes, &found, SMB_HASH_SOURCE_ALL, update)==SMB_SUCCESS && !update) {
if(smb_findhash(smb, hashes, &found, SMB_HASH_SOURCE_DUPE, update)==SMB_SUCCESS && !update) {
retval=SMB_DUPE_MSG;
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"duplicate %s: %s found in message #%lu"
......
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