1.1 --- a/imiptools/content.py Tue Jan 27 01:29:36 2015 +0100
1.2 +++ b/imiptools/content.py Tue Jan 27 18:48:58 2015 +0100
1.3 @@ -241,11 +241,11 @@
1.4
1.5 # Handler mechanism objects.
1.6
1.7 -def handle_itip_part(part, senders, recipients, handlers, messenger):
1.8 +def handle_itip_part(part, senders, recipient, handlers, messenger):
1.9
1.10 """
1.11 Handle the given iTIP 'part' from the given 'senders' for the given
1.12 - 'recipients' using the given 'handlers' and information provided by the
1.13 + 'recipient' using the given 'handlers' and information provided by the
1.14 given 'messenger'. Return a list of responses, each response being a tuple
1.15 of the form (is-outgoing, message-part).
1.16 """
1.17 @@ -276,7 +276,7 @@
1.18
1.19 # Dispatch to a handler and obtain any response.
1.20
1.21 - handler = cls(details, senders, recipients, messenger)
1.22 + handler = cls(details, senders, recipient, messenger)
1.23 result = methods[method](handler)()
1.24
1.25 # Aggregate responses for a single message.
1.26 @@ -340,16 +340,16 @@
1.27
1.28 "General handler support."
1.29
1.30 - def __init__(self, details, senders=None, recipients=None, messenger=None):
1.31 + def __init__(self, details, senders=None, recipient=None, messenger=None):
1.32
1.33 """
1.34 Initialise the handler with the 'details' of a calendar object and the
1.35 - 'senders' and 'recipients' of the object (if specifically indicated).
1.36 + 'senders' and 'recipient' of the object (if specifically indicated).
1.37 """
1.38
1.39 self.details = details
1.40 self.senders = senders and set(map(get_address, senders))
1.41 - self.recipients = recipients and set(map(get_address, recipients))
1.42 + self.recipient = recipient and get_address(recipient)
1.43 self.messenger = messenger
1.44
1.45 self.uid = get_value(details, "UID")
1.46 @@ -424,24 +424,24 @@
1.47 else:
1.48 return mapping
1.49
1.50 - def filter_by_recipients(self, mapping):
1.51 + def filter_by_recipient(self, mapping):
1.52
1.53 """
1.54 Return a list of items from 'mapping' filtered using recipient
1.55 information.
1.56 """
1.57
1.58 - if self.recipients:
1.59 - addresses = map(get_address, mapping)
1.60 - return map(get_uri, self.recipients.intersection(addresses))
1.61 + if self.recipient:
1.62 + addresses = set(map(get_address, mapping))
1.63 + return map(get_uri, addresses.intersection([self.recipient]))
1.64 else:
1.65 return mapping
1.66
1.67 def require_organiser_and_attendees(self, from_organiser=True):
1.68
1.69 """
1.70 - Return the organiser and attendees for the current object, filtered by
1.71 - the recipients of interest. Return None if no identities are eligible.
1.72 + Return the organiser and attendees for the current object, filtered for
1.73 + the recipient of interest. Return None if no identities are eligible.
1.74
1.75 Organiser and attendee identities are provided as lower case values.
1.76 """
1.77 @@ -451,7 +451,7 @@
1.78
1.79 # Only provide details for attendees who sent/receive the message.
1.80
1.81 - attendee_filter_fn = from_organiser and self.filter_by_recipients or self.filter_by_senders
1.82 + attendee_filter_fn = from_organiser and self.filter_by_recipient or self.filter_by_senders
1.83
1.84 attendees = {}
1.85 for attendee in attendee_filter_fn(attendee_map):
1.86 @@ -462,7 +462,7 @@
1.87
1.88 # Only provide details for an organiser who sent/receives the message.
1.89
1.90 - organiser_filter_fn = from_organiser and self.filter_by_senders or self.filter_by_recipients
1.91 + organiser_filter_fn = from_organiser and self.filter_by_senders or self.filter_by_recipient
1.92
1.93 if not organiser_filter_fn(dict([organiser_item])):
1.94 return None