From 66581498212e2d0643c50369b1f39b85d7dc4dce Mon Sep 17 00:00:00 2001
From: minima <minima>
Date: Fri, 12 Oct 2001 11:39:14 +0000
Subject: [PATCH] substr the subject in the dup check so that AK1A msg dups are
 not treated as new

---
 Changes       |  1 +
 perl/DXMsg.pm | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Changes b/Changes
index 001e9e1c..0a515c1e 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
 12Oct01=======================================================================
 1. make del nnn delete messages again (fix system Aliases file)
+2. substr the subject so that the dup works for stuff coming back via AK1A
 09Oct01=======================================================================
 1. change Aliases to allow shutdown as a command again. If you have changed
 /spider/cmd/Aliases and you update from CVS you may find it better to remove
diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm
index 677888f8..04239f16 100644
--- a/perl/DXMsg.pm
+++ b/perl/DXMsg.pm
@@ -282,7 +282,7 @@ sub process
 						# does an identical message already exist?
 						my $m;
 						for $m (@msg) {
-							if ($ref->{subject} eq $m->{subject} && $ref->{t} == $m->{t} && $ref->{from} eq $m->{from} && $ref->{to} eq $m->{to}) {
+							if (substr($ref->{subject},0,28) eq substr($m->{subject},0,28) && $ref->{t} == $m->{t} && $ref->{from} eq $m->{from} && $ref->{to} eq $m->{to}) {
 								$ref->stop_msg($fromnode);
 								my $msgno = $m->{msgno};
 								dbg("duplicate message from $ref->{from} -> $ref->{to} to msg: $msgno") if isdbg('msg');
@@ -1325,7 +1325,18 @@ sub import_one
 	} else {
 		push @chunk, $ref;
 	}
-				  
+
+	# does an identical message already exist?
+	my $m;
+	for $m (@msg) {
+		if (substr($subject,0,28) eq substr($m->{subject},0,28) && $from eq $m->{from} && grep $m->{to} eq $_, @to) {
+			my $msgno = $m->{msgno};
+			dbg("duplicate message from $from -> $m->{to} to msg: $msgno") if isdbg('msg');
+			Log('msg', "duplicate message from $from -> $m->{to} to msg: $msgno");
+			return;
+		}
+	}
+
     # write all the messages away
 	my $i;
 	for ( $i = 0;  $i < @chunk; $i++) {
-- 
2.43.0