| 1005 | |
| 1006 | # Check whether we just finished processing an AppleDouble container |
| 1007 | if part not in appledouble_parts: |
| 1008 | appledouble_parts = [] |
| 1009 | |
| 1010 | # Special handling for BinHex attachments. Options are drop (leave out with no warning), warn (and leave out), and keep |
| 1011 | if part.get_content_type() == 'application/mac-binhex40': |
| 1012 | if self.BINHEX == 'warn': |
| 1013 | message_parts.append("'''A BinHex attachment named '%s' was ignored (use MIME encoding instead).'''" % part.get_filename()) |
| 1014 | continue |
| 1015 | elif self.BINHEX == 'drop': |
| 1016 | continue |
| 1017 | |
| 1018 | # Special handling for AppleSingle attachments. Options are drop (leave out with no warning), warn (and leave out), and keep |
| 1019 | if part.get_content_type() == 'application/applefile' and not part in appledouble_parts: |
| 1020 | if self.APPLESINGLE == 'warn': |
| 1021 | message_parts.append("'''An AppleSingle attachment named '%s' was ignored (use MIME encoding instead).'''" % part.get_filename()) |
| 1022 | continue |
| 1023 | elif self.APPLESINGLE == 'drop': |
| 1024 | continue |
| 1026 | # Special handling for the Mac-specific part of AppleDouble attachments. Options are strip (leave out with no warning), warn (and leave out), and keep |
| 1027 | if part.get_content_type() == 'application/applefile': |
| 1028 | if self.APPLEDOUBLE == 'warn': |
| 1029 | message_parts.append("'''The resource fork of an attachment named '%s' was removed.'''" % part.get_filename()) |
| 1030 | continue |
| 1031 | elif self.APPLEDOUBLE == 'strip': |
| 1032 | continue |
| 1033 | |
| 1034 | # If we entering an AppleDouble container, set up appledouble_parts so that we know what to do with its subparts |
| 1035 | if part.get_content_type() == 'multipart/appledouble': |
| 1036 | appledouble_parts = part.get_payload() |
| 1037 | continue |
| 1038 | |
| 1039 | # Any other multipart/* is just a container for multipart messages |