1.1 --- a/imiptools/client.py Fri Oct 16 16:19:05 2015 +0200
1.2 +++ b/imiptools/client.py Fri Oct 16 18:45:36 2015 +0200
1.3 @@ -194,6 +194,23 @@
1.4
1.5 # Common operations on calendar data.
1.6
1.7 + def update_senders(self, obj=None):
1.8 +
1.9 + """
1.10 + Update sender details in 'obj', or the current object if not indicated,
1.11 + removing SENT-BY attributes for attendees other than the current user if
1.12 + those attributes give the URI of the calendar system.
1.13 + """
1.14 +
1.15 + obj = obj or self.obj
1.16 + calendar_uri = get_uri(self.messenger.sender)
1.17 + for attendee, attendee_attr in uri_items(obj.get_items("ATTENDEE")):
1.18 + if attendee != self.user:
1.19 + if attendee_attr.get("SENT-BY") == calendar_uri:
1.20 + del attendee_attr["SENT-BY"]
1.21 + else:
1.22 + attendee_attr["SENT-BY"] = calendar_uri
1.23 +
1.24 def update_sender(self, attr):
1.25
1.26 "Update the SENT-BY attribute of the 'attr' sender metadata."
1.27 @@ -205,7 +222,7 @@
1.28
1.29 "Return the attendee who sent the current object."
1.30
1.31 - calendar_uri = get_uri(config.MESSAGE_SENDER)
1.32 + calendar_uri = get_uri(self.messenger.sender)
1.33 for attendee, attendee_attr in uri_items(self.obj.get_items("ATTENDEE")):
1.34 if attendee_attr.get("SENT-BY") == calendar_uri:
1.35 return get_uri(attendee)