summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dfd31f6)
raw | patch | inline | side by side (parent: dfd31f6)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 27 Dec 2002 23:54:05 +0000 (23:54 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 27 Dec 2002 23:54:05 +0000 (23:54 +0000) |
(multipart/alternative, "fw" and content-type "name")
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1419 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1419 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 205552991db93505645a0a4f2795e0eea53d9662..77c11c25fa5f1825afcedfd082072d8c556ac1cd 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- fixed time default in date.py
- fixed error in cgi/templates.py (sf bug 652089)
- fixed handling of missing password (sf bug 655632)
+- applied patches for handling Outlook quirks (thanks Andrey Lebedev)
+ (multipart/alternative, "fw" and content-type "name")
2002-12-11 0.5.3
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 9de891be5ccd136bbbc6de31f5b9800ab533c9bb..9d1fc8e1e031c08472067447b4d16b3172d45be6 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.102 2002-12-11 01:52:20 richard Exp $
+$Id: mailgw.py,v 1.103 2002-12-27 23:54:05 richard Exp $
'''
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
s.seek(0)
return Message(s)
-subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re|aw)\W\s*)*'
+subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fw|fwd|re|aw)\W\s*)*'
r'\s*(?P<quote>")?(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])?'
r'\s*(?P<title>[^[]+)?"?(\[(?P<args>.+?)\])?', re.I)
name = mailmess.getheader('subject')
part.fp.seek(i)
attachments.append((name, 'message/rfc822', part.fp.read()))
+ elif subtype == 'multipart/alternative':
+ # Search for text/plain in message with attachment and
+ # alternative text representation
+ part.getPart()
+ while 1:
+ # get the next part
+ subpart = part.getPart()
+ if subpart is None:
+ break
+ # parse it
+ if subpart.gettype() == 'text/plain' and not content:
+ content = self.get_part_data_decoded(subpart)
else:
# try name on Content-Type
- name = part.getparam('name').strip()
+ name = part.getparam('name')
+ if name:
+ name = name.strip()
if not name:
disp = part.getheader('content-disposition', None)
if disp:
- name = disp.getparam('filename').strip()
+ name = disp.getparam('filename')
+ if name:
+ name = name.strip()
# this is just an attachment
data = self.get_part_data_decoded(part)
attachments.append((name, part.gettype(), data))
blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
eol=re.compile(r'[\r\n]+'),
signature=re.compile(r'^[>|\s]*[-_]+\s*$'),
- original_message=re.compile(r'^[>|\s]*-----Original Message-----$')):
+ original_msg=re.compile(r'^[>|\s]*-----\s?Original Message\s?-----$')):
''' The message body is divided into sections by blank lines.
Sections where the second and all subsequent lines begin with a ">"
or "|" character are considered "quoting sections". The first line of
elif signature.match(lines[0]) and 2 <= len(lines) <= 10:
# lose any signature
break
- elif original_message.match(lines[0]):
+ elif original_msg.match(lines[0]):
# ditch the stupid Outlook quoting of the entire original message
break