From 22e48f901d6a534186be75045abff022142db04b Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Mon, 1 Aug 2005 23:22:02 +0000 Subject: [PATCH] No longer calculate, store, or look-up hashes for the mail database. Since we're not using the message-ID for dupe checking or threading and we already have a mechanism in place for body text dupe detection (via CRC-32) the hash mechanism is providing an unnecessary burden on the mail database. --- src/sbbs3/chksmb.c | 7 ++++--- src/smblib/smbadd.c | 28 ++++++++++++++++------------ src/smblib/smbhash.c | 3 +++ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/sbbs3/chksmb.c b/src/sbbs3/chksmb.c index d5d5899187..aad9480de3 100644 --- a/src/sbbs3/chksmb.c +++ b/src/sbbs3/chksmb.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -340,10 +340,11 @@ int main(int argc, char **argv) } } - if(chkhash) { + if(!(smb.status.attr&SMB_EMAIL) && chkhash) { /* Look-up the message hashes */ hashes=smb_msghashes(&msg,body); - if(hashes[0]!=NULL + if(hashes!=NULL + && hashes[0]!=NULL && (i=smb_findhash(&smb,hashes,NULL,SMB_HASH_SOURCE_ALL,/* mark */TRUE )) !=SMB_SUCCESS) { for(h=0;hashes[h]!=NULL;h++) { diff --git a/src/smblib/smbadd.c b/src/smblib/smbadd.c index 28b25d64c3..f856fbf76f 100644 --- a/src/smblib/smbadd.c +++ b/src/smblib/smbadd.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -83,16 +83,19 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash break; msg->hdr.number=smb->status.last_msg+1; - hashes=smb_msghashes(msg,body); - - if(smb_findhash(smb, hashes, &found, dupechk_hashes, /* mark? */FALSE)==SMB_SUCCESS) { - safe_snprintf(smb->last_error,sizeof(smb->last_error) - ,"duplicate %s: %s found in message #%lu" - ,smb_hashsourcetype(found.source) - ,smb_hashsource(msg,found.source) - ,found.number); - retval=SMB_DUPE_MSG; - break; + if(!(smb->status.attr&SMB_EMAIL)) { + + hashes=smb_msghashes(msg,body); + + if(smb_findhash(smb, hashes, &found, dupechk_hashes, /* mark? */FALSE)==SMB_SUCCESS) { + safe_snprintf(smb->last_error,sizeof(smb->last_error) + ,"duplicate %s: %s found in message #%lu" + ,smb_hashsourcetype(found.source) + ,smb_hashsource(msg,found.source) + ,found.number); + retval=SMB_DUPE_MSG; + break; + } } if(tail!=NULL && (taillen=strlen(tail))>0) @@ -290,7 +293,8 @@ int SMBCALL smb_addmsg(smb_t* smb, smbmsg_t* msg, int storage, long dupechk_hash } } - if(smb_addhashes(smb,hashes,/* skip_marked? */FALSE)==SMB_SUCCESS) + if(!(smb->status.attr&SMB_EMAIL) + && smb_addhashes(smb,hashes,/* skip_marked? */FALSE)==SMB_SUCCESS) msg->flags|=MSG_FLAG_HASHED; if(msg->to==NULL) /* no recipient, don't add header (required for bulkmail) */ break; diff --git a/src/smblib/smbhash.c b/src/smblib/smbhash.c index 69718e689c..3360d6b5c3 100644 --- a/src/smblib/smbhash.c +++ b/src/smblib/smbhash.c @@ -257,6 +257,9 @@ int SMBCALL smb_hashmsg(smb_t* smb, smbmsg_t* msg, const uchar* text, BOOL updat hash_t found; hash_t** hashes; /* This is a NULL-terminated list of hashes */ + if(smb->status.attr&SMB_EMAIL) + return(SMB_SUCCESS); + hashes=smb_msghashes(msg,text); if(smb_findhash(smb, hashes, &found, SMB_HASH_SOURCE_ALL, update)==SMB_SUCCESS && !update) { -- GitLab