From b4e5115d54a6e5937febba25ffea51b933653c7d Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 26 Sep 2002 00:01:51 +0000 Subject: [PATCH] handle stupid mailers quoting subject lines git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1241 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/mailgw.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 90e98af..0af651d 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.90 2002-09-25 05:13:34 richard Exp $ +$Id: mailgw.py,v 1.91 2002-09-26 00:01:51 richard Exp $ ''' import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri @@ -131,8 +131,8 @@ class Message(mimetools.Message): return Message(s) subject_re = re.compile(r'(?P\s*\W?\s*(fwd|re|aw)\s*\W?\s*)*' - r'\s*(\[(?P[^\d\s]+)(?P\d+)?\])?' - r'\s*(?P[^[]+)?(\[(?P<args>.+?)\])?', re.I) + r'\s*(P<quote>")?(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])?' + r'\s*(?P<title>[^[]+)?"?(\[(?P<args>.+?)\])?', re.I) class MailGW: def __init__(self, instance, db): @@ -435,6 +435,11 @@ Subject was: "%s" else: title = '' + # strip off the quotes that dumb emailers put around the subject, like + # Re: "[issue1] bla blah" + if m.group('quote') and title.endswith('"'): + title = title[:-1] + # but we do need either a title or a nodeid... if nodeid is None and not title: raise MailUsageError, ''' -- 2.30.2