# HG changeset patch # User Paul Boddie # Date 1422381800 -3600 # Node ID 27338cdf885fdc316e3bcd8304faa58d0f775711 # Parent ddd660cf1e905f0fbd128ff07fdac2e349a6ce5f Made free/busy notifications and sharing subject to user preferences. diff -r ddd660cf1e90 -r 27338cdf885f imiptools/handlers/person.py --- a/imiptools/handlers/person.py Tue Jan 27 18:48:58 2015 +0100 +++ b/imiptools/handlers/person.py Tue Jan 27 19:03:20 2015 +0100 @@ -221,19 +221,25 @@ "Register free/busy information." - # NOTE: This could be configured to not produce a message. + self._record_freebusy(from_organiser=True) + + # Produce a message if configured to do so. - self._record_freebusy(from_organiser=True) - return self.wrap("PUBLISH", "A free/busy update has been received.", from_organiser=True, link=False) + preferences = Preferences(get_uri(self.recipient)) + if preferences.get("freebusy_messages") == "notify": + return self.wrap("PUBLISH", "A free/busy update has been received.", from_organiser=True, link=False) def reply(self): "Record replies and notify the recipient." - # NOTE: This could be configured to not produce a message. + self._record_freebusy(from_organiser=False) + + # Produce a message if configured to do so. - self._record_freebusy(from_organiser=False) - return self.wrap("REPLY", "A reply has been received.", from_organiser=False, link=False) + preferences = Preferences(get_uri(self.recipient)) + if preferences.get("freebusy_messages") == "notify": + return self.wrap("REPLY", "A reply to a free/busy request has been received.", from_organiser=False, link=False) def request(self): @@ -242,9 +248,11 @@ information for each indicated attendee. """ - # NOTE: This should be subject to policy/preferences. + # Produce a reply if configured to do so. - return CommonFreebusy.request(self) + preferences = Preferences(get_uri(self.recipient)) + if preferences.get("freebusy_sharing") == "share": + return CommonFreebusy.request(self) class Journal(PersonHandler):