1.1 --- a/imiptools/handlers/resource.py Sun Feb 07 23:35:20 2016 +0100
1.2 +++ b/imiptools/handlers/resource.py Mon Feb 08 00:14:53 2016 +0100
1.3 @@ -22,7 +22,8 @@
1.4 from imiptools.data import get_address, to_part, uri_dict
1.5 from imiptools.handlers import Handler
1.6 from imiptools.handlers.common import CommonFreebusy, CommonEvent
1.7 -from imiptools.handlers.scheduling import apply_scheduling_functions
1.8 +from imiptools.handlers.scheduling import apply_scheduling_functions, \
1.9 + confirm_scheduling, retract_scheduling
1.10
1.11 class ResourceHandler(CommonEvent, Handler):
1.12
1.13 @@ -77,6 +78,10 @@
1.14
1.15 self.update_event_in_freebusy(for_organiser=False)
1.16
1.17 + # Confirm the scheduling of the recurrence.
1.18 +
1.19 + self.confirm_scheduling()
1.20 +
1.21 def _schedule_for_attendee(self):
1.22
1.23 "Attempt to schedule the current object for the current user."
1.24 @@ -108,6 +113,11 @@
1.25 else:
1.26 self.store.remove_cancellation(self.user, self.uid, self.recurrenceid)
1.27
1.28 + # Confirm any scheduling.
1.29 +
1.30 + if scheduled == "ACCEPTED":
1.31 + self.confirm_scheduling()
1.32 +
1.33 # For countered proposals, record the offer in the resource's
1.34 # free/busy collection.
1.35
1.36 @@ -145,6 +155,10 @@
1.37 self.store.set_event(self.user, self.uid, self.recurrenceid, self.obj.to_node())
1.38 self.store.cancel_event(self.user, self.uid, self.recurrenceid)
1.39
1.40 + # Retract the scheduling of the event.
1.41 +
1.42 + self.retract_scheduling()
1.43 +
1.44 def _revoke_for_attendee(self):
1.45
1.46 "Revoke any counter-proposal recorded as a free/busy offer."
1.47 @@ -169,6 +183,24 @@
1.48
1.49 return apply_scheduling_functions(functions, self)
1.50
1.51 + def confirm_scheduling(self):
1.52 +
1.53 + "Confirm that this event has been scheduled."
1.54 +
1.55 + functions = self.get_preferences().get("confirmation_function")
1.56 +
1.57 + if functions:
1.58 + confirm_scheduling(functions.split("\n"), self)
1.59 +
1.60 + def retract_scheduling(self):
1.61 +
1.62 + "Retract this event from scheduling records."
1.63 +
1.64 + functions = self.get_preferences().get("retraction_function")
1.65 +
1.66 + if functions:
1.67 + retract_scheduling(functions.split("\n"), self)
1.68 +
1.69 class Event(ResourceHandler):
1.70
1.71 "An event handler."