1.1 --- a/imiptools/__init__.py Sun Feb 01 17:03:31 2015 +0100
1.2 +++ b/imiptools/__init__.py Sun Feb 01 18:26:21 2015 +0100
1.3 @@ -99,25 +99,29 @@
1.4 # Pack any returned parts into messages.
1.5
1.6 if all_responses:
1.7 - outgoing_parts = []
1.8 + outgoing_parts = {}
1.9 forwarded_parts = []
1.10
1.11 - for outgoing, part in all_responses:
1.12 - if outgoing:
1.13 - outgoing_parts.append(part)
1.14 + for outgoing_recipients, part in all_responses:
1.15 + if outgoing_recipients:
1.16 + for outgoing_recipient in outgoing_recipients:
1.17 + if not outgoing_parts.has_key(outgoing_recipient):
1.18 + outgoing_parts[outgoing_recipient] = []
1.19 + outgoing_parts[outgoing_recipient].append(part)
1.20 else:
1.21 forwarded_parts.append(part)
1.22
1.23 # Reply using any outgoing parts in a new message.
1.24
1.25 if outgoing_parts:
1.26 - message = self.messenger.make_outgoing_message(outgoing_parts, senders)
1.27 + for outgoing_recipient, parts in outgoing_parts.items():
1.28 + message = self.messenger.make_outgoing_message(parts, [outgoing_recipient])
1.29
1.30 - if "-d" in sys.argv:
1.31 - print >>sys.stderr, "Outgoing parts..."
1.32 - print message
1.33 - else:
1.34 - self.messenger.sendmail(senders, message.as_string())
1.35 + if "-d" in sys.argv:
1.36 + print >>sys.stderr, "Outgoing parts for %s..." % outgoing_recipient
1.37 + print message
1.38 + else:
1.39 + self.messenger.sendmail([outgoing_recipient], message.as_string())
1.40
1.41 # Forward messages to their recipients either wrapping the existing
1.42 # message, accompanying it or replacing it.
2.1 --- a/imiptools/content.py Sun Feb 01 17:03:31 2015 +0100
2.2 +++ b/imiptools/content.py Sun Feb 01 18:26:21 2015 +0100
2.3 @@ -211,8 +211,8 @@
2.4
2.5 if results:
2.6 for result in results:
2.7 - outgoing, part = result
2.8 - all_results.append((outgoing, part))
2.9 + outgoing_recipients, part = result
2.10 + all_results.append((outgoing_recipients, part))
2.11
2.12 return all_results
2.13
2.14 @@ -265,7 +265,7 @@
2.15 "message, you may view the details here:\n\n%s" %
2.16 get_object_url(self.uid))
2.17
2.18 - return [(False, MIMEText("\n".join(texts)))]
2.19 + return [(None, MIMEText("\n".join(texts)))]
2.20
2.21 # Access to calendar structures and other data.
2.22
3.1 --- a/imiptools/handlers/common.py Sun Feb 01 17:03:31 2015 +0100
3.2 +++ b/imiptools/handlers/common.py Sun Feb 01 18:26:21 2015 +0100
3.3 @@ -19,7 +19,7 @@
3.4 this program. If not, see <http://www.gnu.org/licenses/>.
3.5 """
3.6
3.7 -from imiptools.data import to_part
3.8 +from imiptools.data import get_address, to_part
3.9
3.10 class SupportFreebusy:
3.11
3.12 @@ -38,7 +38,12 @@
3.13 # Return a published object.
3.14
3.15 if calendar:
3.16 - return [(True, to_part("PUBLISH", calendar))]
3.17 + return [(
3.18 + map(get_address,
3.19 + from_organiser and self.obj.get_values("ATTENDEE") or
3.20 + self.obj.get_values("ORGANIZER")),
3.21 + to_part("PUBLISH", calendar)
3.22 + )]
3.23
3.24 def make_freebusy(self, from_organiser=True, publish=False):
3.25
3.26 @@ -113,6 +118,6 @@
3.27
3.28 # Return the reply.
3.29
3.30 - return [(True, to_part("REPLY", calendar))]
3.31 + return [(map(get_address, self.obj.get_values("ORGANIZER")), to_part("REPLY", calendar))]
3.32
3.33 # vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/imiptools/handlers/resource.py Sun Feb 01 17:03:31 2015 +0100
4.2 +++ b/imiptools/handlers/resource.py Sun Feb 01 18:26:21 2015 +0100
4.3 @@ -152,7 +152,7 @@
4.4
4.5 response = self._record_and_respond(self._schedule_for_attendee)
4.6 if response:
4.7 - return [(True, to_part("REPLY", response))]
4.8 + return [(map(get_address, self.obj.get_values("ORGANIZER")), to_part("REPLY", response))]
4.9 else:
4.10 return None
4.11