Changeset 278
- Timestamp:
- 08/25/09 11:53:01 (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r276 r278 1 2009-XX-XX 2 * Implemented a new feature to drop the HTML version of multipart/alternative 3 message part. Such a message part containts the same info, but have are sent 4 in different formats and client can decided what version is used, closes #30 5 6 Implemented by: Bas van der Vlies 7 1 8 2009-08-20 2 9 * updated aclocal.m4 to support python versions 2.5 and 2.6, closes #137 -
trunk/debian/changelog
r276 r278 1 email2trac (1.0.0-1) stable; urgency=low 2 3 * Implemented a new feature to drop the HTML version of multipart/alternative 4 message part. Such a message part containts the same info, but have are sent 5 in different formats and client can decided what version is used, closes #30 6 7 Implemented by: Bas van der Vlies 8 9 -- Bas van der Vlies <basv@sara.nl> Tue, 25 Aug 2009 11:50:40 +0200 10 1 11 email2trac (0.90-1) stable; urgency=low 2 12 … … 24 34 Applied by: Bas van der Vlies 25 35 26 27 * default trac version for email2trac is now updated to 0.11 36 * default trac version for email2trac is now updated to 0.11 28 37 29 38 -- Bas van der Vlies <basv@sara.nl> Thu, 04 Jun 2009 14:48:11 +0200 -
trunk/email2trac.conf
r222 r278 19 19 ignore_trac_user_settings: 0 20 20 black_list: MAILER-DAEMON@ 21 drop_alternative_html_version: 1 21 22 22 23 -
trunk/email2trac.py.in
r276 r278 230 230 self.REFLOW = 1 231 231 232 if parameters.has_key('drop_alternative_html_version'): 233 self.DROP_ALTERNATIVE_HTML_VERSION = int(parameters['drop_alternative_html_version']) 234 else: 235 self.DROP_ALTERNATIVE_HTML_VERSION = 0 236 232 237 if parameters.has_key('strip_signature'): 233 238 self.STRIP_SIGNATURE = int(parameters['strip_signature']) … … 1104 1109 appledouble_parts = [] 1105 1110 1111 ALTERNATIVE_MULTIPART = False 1112 1106 1113 for part in msg.walk(): 1107 1114 if self.DEBUG: 1115 print 'TD: Message part: Main-Type: %s' % part.get_content_maintype() 1108 1116 print 'TD: Message part: Content-Type: %s' % part.get_content_type() 1109 1117 1118 1110 1119 # Check whether we just finished processing an AppleDouble container 1111 1120 if part not in appledouble_parts: 1112 1121 appledouble_parts = [] 1113 1122 1114 # Special handling for BinHex attachments. Options are drop (leave out with no warning), warn (and leave out), and keep 1123 ## Check content type 1124 # 1115 1125 if part.get_content_type() == 'application/mac-binhex40': 1126 # 1127 # Special handling for BinHex attachments. Options are drop (leave out with no warning), warn (and leave out), and keep 1128 # 1116 1129 if self.BINHEX == 'warn': 1117 1130 message_parts.append("'''A BinHex attachment named '%s' was ignored (use MIME encoding instead).'''" % part.get_filename()) … … 1120 1133 continue 1121 1134 1122 # Special handling for AppleSingle attachments. Options are drop (leave out with no warning), warn (and leave out), and keep 1123 if part.get_content_type() == 'application/applefile' and not part in appledouble_parts: 1124 if self.APPLESINGLE == 'warn': 1125 message_parts.append("'''An AppleSingle attachment named '%s' was ignored (use MIME encoding instead).'''" % part.get_filename()) 1126 continue 1127 elif self.APPLESINGLE == 'drop': 1128 continue 1129 1130 # Special handling for the Mac-specific part of AppleDouble attachments. Options are strip (leave out with no warning), warn (and leave out), and keep 1131 if part.get_content_type() == 'application/applefile': 1132 if self.APPLEDOUBLE == 'warn': 1133 message_parts.append("'''The resource fork of an attachment named '%s' was removed.'''" % part.get_filename()) 1134 continue 1135 elif self.APPLEDOUBLE == 'strip': 1136 continue 1137 1138 # If we entering an AppleDouble container, set up appledouble_parts so that we know what to do with its subparts 1139 if part.get_content_type() == 'multipart/appledouble': 1135 elif part.get_content_type() == 'application/applefile': 1136 # 1137 # Special handling for the Mac-specific part of AppleDouble/AppleSingle attachments. Options are strip (leave out with no warning), warn (and leave out), and keep 1138 # 1139 1140 if part in appledouble_parts: 1141 if self.APPLEDOUBLE == 'warn': 1142 message_parts.append("'''The resource fork of an attachment named '%s' was removed.'''" % part.get_filename()) 1143 continue 1144 elif self.APPLEDOUBLE == 'strip': 1145 continue 1146 else: 1147 if self.APPLESINGLE == 'warn': 1148 message_parts.append("'''An AppleSingle attachment named '%s' was ignored (use MIME encoding instead).'''" % part.get_filename()) 1149 continue 1150 elif self.APPLESINGLE == 'drop': 1151 continue 1152 1153 elif part.get_content_type() == 'multipart/appledouble': 1154 # 1155 # If we entering an AppleDouble container, set up appledouble_parts so that we know what to do with its subparts 1156 # 1140 1157 appledouble_parts = part.get_payload() 1141 1158 continue 1142 1159 1143 # Any other multipart/* is just a container for multipart messages 1160 elif part.get_content_type() == 'multipart/alternative': 1161 ALTERNATIVE_MULTIPART = True 1162 continue 1163 1164 # Skip multipart containers 1165 # 1144 1166 if part.get_content_maintype() == 'multipart': 1167 if self.DEBUG: 1168 print "TD: Skipping multipart container" 1145 1169 continue 1146 1170 1147 1171 # Check if this is an inline part. It's inline if there is co Cont-Disp header, or if there is one and it says "inline" 1148 1172 inline = self.inline_part(part) 1173 1174 # Drop HTML message 1175 if ALTERNATIVE_MULTIPART and self.DROP_ALTERNATIVE_HTML_VERSION: 1176 if part.get_content_type() == 'text/html': 1177 if self.DEBUG: 1178 print "TD: Skipping alternative HTML message" 1179 1180 ALTERNATIVE_MULTIPART = False 1181 continue 1149 1182 1150 1183 # Inline text parts are where the body is
Note: See TracChangeset
for help on using the changeset viewer.