Skip to content

Commit 44d1314

Browse files
author
Erik Forsberg
committed
Fix bug in matching In-Reply-To header to existing Message-ID and add unit test.
1 parent 90c600c commit 44d1314

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

roundup/mailgw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.180 2006-12-19 01:13:31 richard Exp $
75+
$Id: mailgw.py,v 1.181 2007-01-21 15:18:26 forsberg Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -718,7 +718,7 @@ def handle_message(self, message):
718718
# try in-reply-to to match the message if there's no nodeid
719719
inreplyto = message.getheader('in-reply-to') or ''
720720
if nodeid is None and inreplyto:
721-
l = self.db.getclass('msg').stringFind(inreplyto=inreplyto)
721+
l = self.db.getclass('msg').stringFind(messageid=inreplyto)
722722
if l:
723723
nodeid = l[0]
724724

test/test_mailgw.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.79 2006-10-05 23:08:21 richard Exp $
11+
# $Id: test_mailgw.py,v 1.80 2007-01-21 15:18:25 forsberg Exp $
1212

1313
# TODO: test bcc
1414

@@ -1285,6 +1285,22 @@ def testCommandDelimitersIgnore(self):
12851285
'testing [assignedto=mary]')
12861286
self.assertEqual(self.db.issue.get(nodeid, 'assignedto'), None)
12871287

1288+
def testReplytoMatch(self):
1289+
self.instance.config.MAILGW_SUBJECT_PREFIX_PARSING = 'loose'
1290+
nodeid = self.doNewIssue()
1291+
nodeid2 = self._handle_mail('''Content-Type: text/plain;
1292+
charset="iso-8859-1"
1293+
From: Chef <[email protected]>
1294+
1295+
Message-Id: <dummy_test_message_id2>
1296+
In-Reply-To: <dummy_test_message_id>
1297+
Subject: Testing...
1298+
1299+
Followup message.
1300+
''')
1301+
self.assertEqual(nodeid, nodeid2)
1302+
1303+
12881304
def test_suite():
12891305
suite = unittest.TestSuite()
12901306
suite.addTest(unittest.makeSuite(MailgwTestCase))

0 commit comments

Comments
 (0)