CVS: tmda/TMDA AutoResponse.py,1.15,1.16 ChangeLog,1.297,1.298
"Jason R. Mastaler" <[email protected]>
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tmda/tmda/TMDA
In directory sc8-pr-cvs1:/tmp/cvs-serv29614/TMDA
Modified Files:
AutoResponse.py ChangeLog
Log Message:
Bugfix. If AUTORESPONSE_INCLUDE_SENDER_COPY = 1 and the message we
are responding to lacked a charset parameter (usually in
Content-Type), the resulting text/rfc822-headers bodypart would have
no charset parameter itself. e.g,
MIME-Version: 1.0
Content-Type: text/rfc822-headers; charset
^^^^^^^
We now pass the default charset (US-ASCII) in as a fallback charset
for these situations.
Also, add a Content-Disposition header field as described in RFC 2183
to the main message headers as well as each MIME bodypart when
auto-responding.
The `inline' disposition is used in all cases which tells the MUA that
each bodypart should be displayed inline automatically upon display of
the message, rather than treated as an attachment.
Content-Disposition is an optional header field, and in its absence,
the RFC says the MUA may use ``whatever presentation method it deems
suitable.'' In most cases, the MUA will likely do the right thing
with a TMDA auto-response, but this just makes sure it does. If the
MUA incorrectly treated a bodypart as an `attachment', the
recipient might not see the confirmation request leading to a lost
message.
Index: AutoResponse.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/AutoResponse.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AutoResponse.py 3 Dec 2003 07:37:54 -0000 1.15
+++ AutoResponse.py 3 Dec 2003 19:10:50 -0000 1.16
@@ -137,12 +137,13 @@
textpart['Content-Description'] = 'Confirmation Acceptance'
elif self.responsetype == 'bounce':
textpart['Content-Description'] = 'Failure Notice'
+ textpart['Content-Disposition'] = 'inline'
self.mimemsg.attach(textpart)
if Defaults.AUTORESPONSE_INCLUDE_SENDER_COPY == 1:
# include the headers only as a text/rfc822-headers part.
rfc822part = MIMEText(
self.msgin_as_string[:self.msgin_as_string.index('\n\n')+1],
- 'rfc822-headers', self.msgin.get_charsets()[0])
+ 'rfc822-headers', self.msgin.get_charsets(DEFAULT_CHARSET)[0])
rfc822part['Content-Description'] = 'Original Message Headers'
elif Defaults.AUTORESPONSE_INCLUDE_SENDER_COPY == 2:
# include the entire message as a message/rfc822 part.
@@ -150,7 +151,11 @@
# been truncated appropriately in the constructor.
rfc822part = MIMEMessage(self.msgin)
rfc822part['Content-Description'] = 'Original Message'
+ rfc822part['Content-Disposition'] = 'inline'
self.mimemsg.attach(rfc822part)
+ # RFC 2183 section 2.10 permits the use Content-Disposition in
+ # the main body of the message.
+ self.mimemsg['Content-Disposition'] = 'inline'
# fold the template headers into the main entity.
for k, v in self.bouncemsg.items():
ksplit = k.split('.', 1)
@@ -208,7 +213,7 @@
self.mimemsg['Auto-Submitted'] = 'auto-generated (failure)'
self.mimemsg['X-Delivery-Agent'] = 'TMDA/%s (%s)' % (Version.TMDA,
Version.CODENAME)
- # Optionally, add some headers.
+ # Optionally, add some custom headers.
Util.add_headers(self.mimemsg, Defaults.ADDED_HEADERS_SERVER)
# Optionally, remove some headers.
Util.purge_headers(self.mimemsg, Defaults.PURGED_HEADERS_SERVER)
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.297
retrieving revision 1.298
diff -u -r1.297 -r1.298
--- ChangeLog 3 Dec 2003 07:37:54 -0000 1.297
+++ ChangeLog 3 Dec 2003 19:10:50 -0000 1.298
@@ -1,3 +1,14 @@
+2003-12-03 Jason R. Mastaler <[email protected]>
+
+ * AutoResponse.py (AutoResponse.create): Add an RFC 2183
+ Content-Disposition = 'inline' header to the main header of the
+ message, as well as each of the MIME bodyparts if
+ AUTORESPONSE_INCLUDE_SENDER_COPY is a positive value.
+
+ (AutoResponse.create): Add a default charset for get_charsets() to
+ fall back to in case the triggering message lacks its own charset
+ parameter.
+
2003-12-03 Tim Legant <[email protected]>
* AutoResponse.py (AutoResponse.__init__): Made msgin_as_string a