1.1 --- a/imiptools/client.py Wed May 20 13:41:23 2015 +0200
1.2 +++ b/imiptools/client.py Wed May 20 15:06:33 2015 +0200
1.3 @@ -19,7 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from imiptools.data import get_uri, get_window_end, uri_dict, uri_items, uri_values
1.8 +from imiptools.data import get_address, get_uri, get_window_end, uri_dict, uri_items, uri_values
1.9 from imiptools.dates import get_default_timezone
1.10 from imiptools.profile import Preferences
1.11
1.12 @@ -66,18 +66,6 @@
1.13
1.14 return to_cancel
1.15
1.16 -def update_participation(obj, user, partstat):
1.17 -
1.18 - "Update the participation in 'obj' of 'user' with the given 'partstat'."
1.19 -
1.20 - existing_attendees = uri_dict(obj.get_value_map("ATTENDEE"))
1.21 -
1.22 - if partstat:
1.23 - if existing_attendees.has_key(user):
1.24 - existing_attendees[user]["PARTSTAT"] = partstat
1.25 - if existing_attendees[user].has_key("RSVP"):
1.26 - del existing_attendees[user]["RSVP"]
1.27 -
1.28 class Client:
1.29
1.30 "Common handler and manager methods."
1.31 @@ -119,4 +107,20 @@
1.32 prefs = self.get_preferences()
1.33 return prefs and prefs.get("freebusy_messages") == "notify" or False
1.34
1.35 + # Common operations on calendar data.
1.36 +
1.37 + def update_participation(self, obj, partstat):
1.38 +
1.39 + """
1.40 + Update the participation in 'obj' of the user with the given 'partstat'.
1.41 + """
1.42 +
1.43 + attendee_attr = uri_dict(obj.get_value_map("ATTENDEE")).get(self.user)
1.44 + attendee_attr["PARTSTAT"] = partstat
1.45 + if attendee_attr.has_key("RSVP"):
1.46 + del attendee_attr["RSVP"]
1.47 + if self.messenger and self.messenger.sender != get_address(self.user):
1.48 + attendee_attr["SENT-BY"] = get_uri(self.messenger.sender)
1.49 + return attendee_attr
1.50 +
1.51 # vim: tabstop=4 expandtab shiftwidth=4