Mercurial > p > roundup > code
changeset 1217:984c498e7deb
handle stupid mailers quoting subject lines
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 26 Sep 2002 00:01:51 +0000 |
| parents | 9e7b2a54f862 |
| children | 4c9882cb16a3 |
| files | roundup/mailgw.py |
| diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/mailgw.py Wed Sep 25 22:35:17 2002 +0000 +++ b/roundup/mailgw.py Thu Sep 26 00:01:51 2002 +0000 @@ -73,7 +73,7 @@ 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 @@ return Message(s) subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re|aw)\s*\W?\s*)*' - r'\s*(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])?' - r'\s*(?P<title>[^[]+)?(\[(?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 @@ 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, '''
