# HG changeset patch # User Paul Boddie # Date 1422811581 -3600 # Node ID 9cbb8429988df4a57208778d6b8e1046b724fb32 # Parent f0ac7db9c976bc6e65a3ea91b98cc20a4bf0a99c Changed the outgoing indicator to communicate the actual recipients, thus supporting participants for whom messages were sent by another party (indicated using SENT-BY in the communicated objects). diff -r f0ac7db9c976 -r 9cbb8429988d imiptools/__init__.py --- a/imiptools/__init__.py Sun Feb 01 17:03:31 2015 +0100 +++ b/imiptools/__init__.py Sun Feb 01 18:26:21 2015 +0100 @@ -99,25 +99,29 @@ # Pack any returned parts into messages. if all_responses: - outgoing_parts = [] + outgoing_parts = {} forwarded_parts = [] - for outgoing, part in all_responses: - if outgoing: - outgoing_parts.append(part) + for outgoing_recipients, part in all_responses: + if outgoing_recipients: + for outgoing_recipient in outgoing_recipients: + if not outgoing_parts.has_key(outgoing_recipient): + outgoing_parts[outgoing_recipient] = [] + outgoing_parts[outgoing_recipient].append(part) else: forwarded_parts.append(part) # Reply using any outgoing parts in a new message. if outgoing_parts: - message = self.messenger.make_outgoing_message(outgoing_parts, senders) + for outgoing_recipient, parts in outgoing_parts.items(): + message = self.messenger.make_outgoing_message(parts, [outgoing_recipient]) - if "-d" in sys.argv: - print >>sys.stderr, "Outgoing parts..." - print message - else: - self.messenger.sendmail(senders, message.as_string()) + if "-d" in sys.argv: + print >>sys.stderr, "Outgoing parts for %s..." % outgoing_recipient + print message + else: + self.messenger.sendmail([outgoing_recipient], message.as_string()) # Forward messages to their recipients either wrapping the existing # message, accompanying it or replacing it. diff -r f0ac7db9c976 -r 9cbb8429988d imiptools/content.py --- a/imiptools/content.py Sun Feb 01 17:03:31 2015 +0100 +++ b/imiptools/content.py Sun Feb 01 18:26:21 2015 +0100 @@ -211,8 +211,8 @@ if results: for result in results: - outgoing, part = result - all_results.append((outgoing, part)) + outgoing_recipients, part = result + all_results.append((outgoing_recipients, part)) return all_results @@ -265,7 +265,7 @@ "message, you may view the details here:\n\n%s" % get_object_url(self.uid)) - return [(False, MIMEText("\n".join(texts)))] + return [(None, MIMEText("\n".join(texts)))] # Access to calendar structures and other data. diff -r f0ac7db9c976 -r 9cbb8429988d imiptools/handlers/common.py --- a/imiptools/handlers/common.py Sun Feb 01 17:03:31 2015 +0100 +++ b/imiptools/handlers/common.py Sun Feb 01 18:26:21 2015 +0100 @@ -19,7 +19,7 @@ this program. If not, see . """ -from imiptools.data import to_part +from imiptools.data import get_address, to_part class SupportFreebusy: @@ -38,7 +38,12 @@ # Return a published object. if calendar: - return [(True, to_part("PUBLISH", calendar))] + return [( + map(get_address, + from_organiser and self.obj.get_values("ATTENDEE") or + self.obj.get_values("ORGANIZER")), + to_part("PUBLISH", calendar) + )] def make_freebusy(self, from_organiser=True, publish=False): @@ -113,6 +118,6 @@ # Return the reply. - return [(True, to_part("REPLY", calendar))] + return [(map(get_address, self.obj.get_values("ORGANIZER")), to_part("REPLY", calendar))] # vim: tabstop=4 expandtab shiftwidth=4 diff -r f0ac7db9c976 -r 9cbb8429988d imiptools/handlers/resource.py --- a/imiptools/handlers/resource.py Sun Feb 01 17:03:31 2015 +0100 +++ b/imiptools/handlers/resource.py Sun Feb 01 18:26:21 2015 +0100 @@ -152,7 +152,7 @@ response = self._record_and_respond(self._schedule_for_attendee) if response: - return [(True, to_part("REPLY", response))] + return [(map(get_address, self.obj.get_values("ORGANIZER")), to_part("REPLY", response))] else: return None