1.1 --- a/imiptools/__init__.py Tue Mar 24 23:33:15 2015 +0100
1.2 +++ b/imiptools/__init__.py Wed Mar 25 16:27:28 2015 +0100
1.3 @@ -65,12 +65,21 @@
1.4
1.5 msg = message_from_file(f)
1.6 senders = get_addresses(msg.get_all("Reply-To") or msg.get_all("From") or [])
1.7 - original_recipients = original_recipients or get_addresses(get_all_values(msg, "To") or [])
1.8
1.9 # Handle messages with iTIP parts.
1.10 + # Typically, the details of recipients are of interest in handling
1.11 + # messages.
1.12
1.13 - for recipient in original_recipients:
1.14 - self.process_for_recipient(msg, recipient, senders, outgoing_only)
1.15 + if not outgoing_only:
1.16 + original_recipients = original_recipients or get_addresses(get_all_values(msg, "To") or [])
1.17 + for recipient in original_recipients:
1.18 + self.process_for_recipient(msg, recipient, senders, outgoing_only)
1.19 +
1.20 + # However, outgoing messages do not usually presume anything about the
1.21 + # eventual recipients.
1.22 +
1.23 + else:
1.24 + self.process_for_recipient(msg, None, senders, outgoing_only)
1.25
1.26 def process_for_recipient(self, msg, recipient, senders, outgoing_only):
1.27