# HG changeset patch # User Paul Boddie # Date 1427297248 -3600 # Node ID d9c3c016b7131260362fda233bd944cce223f3e9 # Parent 56afa5b80507081b6103273e77ff47e687d48c21 Changed outgoing message handling to use a "null" recipient, since outgoing messages should only affect information about the sender. This also prevents repeat processing with multiple recipients, and it allows processing with no eventual recipients (such as when all non-sender participants have been removed from an event). Prevent CANCEL method messages being sent to uninterested or uncontacted participants. diff -r 56afa5b80507 -r d9c3c016b713 imip_manager.py --- a/imip_manager.py Tue Mar 24 23:33:15 2015 +0100 +++ b/imip_manager.py Wed Mar 25 16:27:28 2015 +0100 @@ -157,7 +157,8 @@ for attendee, attendee_attr in attendees: if attendee in removed: - to_cancel.append((attendee, attendee_attr)) + if attendee_attr.get("PARTSTAT") in ("ACCEPTED", "TENTATIVE"): + to_cancel.append((attendee, attendee_attr)) else: remaining.append((attendee, attendee_attr)) diff -r 56afa5b80507 -r d9c3c016b713 imiptools/__init__.py --- a/imiptools/__init__.py Tue Mar 24 23:33:15 2015 +0100 +++ b/imiptools/__init__.py Wed Mar 25 16:27:28 2015 +0100 @@ -65,12 +65,21 @@ msg = message_from_file(f) senders = get_addresses(msg.get_all("Reply-To") or msg.get_all("From") or []) - original_recipients = original_recipients or get_addresses(get_all_values(msg, "To") or []) # Handle messages with iTIP parts. + # Typically, the details of recipients are of interest in handling + # messages. - for recipient in original_recipients: - self.process_for_recipient(msg, recipient, senders, outgoing_only) + if not outgoing_only: + original_recipients = original_recipients or get_addresses(get_all_values(msg, "To") or []) + for recipient in original_recipients: + self.process_for_recipient(msg, recipient, senders, outgoing_only) + + # However, outgoing messages do not usually presume anything about the + # eventual recipients. + + else: + self.process_for_recipient(msg, None, senders, outgoing_only) def process_for_recipient(self, msg, recipient, senders, outgoing_only):