1.1 --- a/imiptools/__init__.py Sun Oct 01 23:09:50 2017 +0200
1.2 +++ b/imiptools/__init__.py Mon Oct 02 19:01:22 2017 +0200
1.3 @@ -22,7 +22,8 @@
1.4 from email import message_from_file
1.5 from imiptools.config import settings
1.6 from imiptools.client import Client
1.7 -from imiptools.content import handle_itip_part
1.8 +from imiptools.content import handle_itip_part, have_itip_part, \
1.9 + is_returned_message
1.10 from imiptools.data import get_address, get_addresses, get_uri
1.11 from imiptools.mail import Messenger
1.12 from imiptools.stores import get_store, get_publisher, get_journal
1.13 @@ -32,13 +33,6 @@
1.14
1.15 EX_TEMPFAIL = 75
1.16
1.17 -# Permitted iTIP content types.
1.18 -
1.19 -itip_content_types = [
1.20 - "text/calendar", # from RFC 6047
1.21 - "text/x-vcalendar", "application/ics", # other possibilities
1.22 - ]
1.23 -
1.24 # Processing of incoming messages.
1.25
1.26 def get_all_values(msg, key):
1.27 @@ -363,23 +357,17 @@
1.28 # Check for participating recipients. Non-participating recipients will
1.29 # have their messages left as being unhandled.
1.30
1.31 - if self.outgoing_only or self.is_participating():
1.32 + if not is_returned_message(msg) and (self.outgoing_only or self.is_participating()):
1.33
1.34 - # Check for returned messages.
1.35 + # Handle parts.
1.36
1.37 for part in msg.walk():
1.38 - if part.get_content_type() == "message/delivery-status":
1.39 - break
1.40 - else:
1.41 - for part in msg.walk():
1.42 - if part.get_content_type() in itip_content_types and \
1.43 - part.get_param("method"):
1.44 + if have_itip_part(part):
1.45 + if self.debug:
1.46 + print >>sys.stderr, "Handle method %s..." % part.get_param("method")
1.47
1.48 - if self.debug:
1.49 - print >>sys.stderr, "Handle method %s..." % part.get_param("method")
1.50 -
1.51 - handle_itip_part(part, handlers)
1.52 - handled = True
1.53 + handle_itip_part(part, handlers)
1.54 + handled = True
1.55
1.56 # When processing outgoing messages, no replies or deliveries are
1.57 # performed.