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

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.
parent f4aa18cd
No related branches found
No related tags found
No related merge requests found
......@@ -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++) {
......
......@@ -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;
......
......@@ -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) {
......
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