# HG changeset patch # User Paul Boddie # Date 1414252414 -7200 # Node ID b57bf0cebf99df300ffd836f15784c2300bb68b0 # Parent 156e52fab8b6599de61994fccd55502a8f5a4f1a Introduced more appropriate default actions for various methods. diff -r 156e52fab8b6 -r b57bf0cebf99 imiptools/handlers/person.py --- a/imiptools/handlers/person.py Fri Oct 24 16:31:14 2014 +0200 +++ b/imiptools/handlers/person.py Sat Oct 25 17:53:34 2014 +0200 @@ -12,33 +12,6 @@ "An event handler." - def add(self): - pass - - def cancel(self): - pass - - def counter(self): - - "Since this handler does not send requests, it will not handle replies." - - pass - - def declinecounter(self): - - """ - Since this handler does not send counter proposals, it will not handle - replies to such proposals. - """ - - pass - - def publish(self): - pass - - def refresh(self): - pass - def _record_and_deliver(self, queue=False): oa = self.require_organiser_and_attendees() @@ -65,6 +38,54 @@ return True + def add(self): + + # NOTE: Queue a suggested modification to any active event. + + # The message is now wrapped and passed on to the recipient. + + return "ADD", MIMEText("An addition to an event has been received.") + + def cancel(self): + + # NOTE: Queue a suggested modification to any active event. + + # The message is now wrapped and passed on to the recipient. + + return "CANCEL", MIMEText("A cancellation has been received.") + + def counter(self): + + # NOTE: Queue a suggested modification to any active event. + + # The message is now wrapped and passed on to the recipient. + + return "COUNTER", MIMEText("A counter proposal has been received.") + + def declinecounter(self): + + # NOTE: Queue a suggested modification to any active event. + + # The message is now wrapped and passed on to the recipient. + + return "DECLINECOUNTER", MIMEText("A declining counter proposal has been received.") + + def publish(self): + + # NOTE: Register details of any relevant event. + + # The message is now wrapped and passed on to the recipient. + + return "PUBLISH", MIMEText("Details of an event have been received.") + + def refresh(self): + + # NOTE: Update details of any active event. + + # The message is now wrapped and passed on to the recipient. + + return "REFRESH", MIMEText("An event update has been received.") + def reply(self): "Record replies and notify the recipient." @@ -90,13 +111,22 @@ "A free/busy handler." def publish(self): - pass + + # NOTE: Register free/busy information. + + # The message is now wrapped and passed on to the recipient. + + return "PUBLISH", MIMEText("Details of a contact's availability have been received.") def reply(self): - "Since this handler does not send requests, it will not handle replies." + "Record replies and notify the recipient." + + self._record_and_deliver(False) - pass + # The message is now wrapped and passed on to the recipient. + + return "REPLY", MIMEText("A reply has been received.") def request(self): @@ -146,53 +176,100 @@ "A journal entry handler." def add(self): - pass + + # NOTE: Queue a suggested modification to any active entry. + + # The message is now wrapped and passed on to the recipient. + + return "ADD", MIMEText("An addition to a journal entry has been received.") def cancel(self): - pass + + # NOTE: Queue a suggested modification to any active entry. + + # The message is now wrapped and passed on to the recipient. + + return "CANCEL", MIMEText("A cancellation has been received.") def publish(self): - pass + + # NOTE: Register details of any relevant entry. + + # The message is now wrapped and passed on to the recipient. + + return "PUBLISH", MIMEText("Details of a journal entry have been received.") class Todo(Handler): "A to-do item handler." def add(self): - pass + + # NOTE: Queue a suggested modification to any active item. + + # The message is now wrapped and passed on to the recipient. + + return "ADD", MIMEText("An addition to an item has been received.") def cancel(self): - pass + + # NOTE: Queue a suggested modification to any active item. + + # The message is now wrapped and passed on to the recipient. + + return "CANCEL", MIMEText("A cancellation has been received.") def counter(self): - "Since this handler does not send requests, it will not handle replies." + # NOTE: Queue a suggested modification to any active item. - pass + # The message is now wrapped and passed on to the recipient. + + return "COUNTER", MIMEText("A counter proposal has been received.") def declinecounter(self): - """ - Since this handler does not send counter proposals, it will not handle - replies to such proposals. - """ + # NOTE: Queue a suggested modification to any active item. - pass + # The message is now wrapped and passed on to the recipient. + + return "DECLINECOUNTER", MIMEText("A declining counter proposal has been received.") def publish(self): - pass + + # NOTE: Register details of any relevant item. + + # The message is now wrapped and passed on to the recipient. + + return "PUBLISH", MIMEText("Details of an item have been received.") def refresh(self): - pass + + # NOTE: Update details of any active item. + + # The message is now wrapped and passed on to the recipient. + + return "REFRESH", MIMEText("An item update has been received.") def reply(self): - "Since this handler does not send requests, it will not handle replies." + "Record replies and notify the recipient." + + self._record_and_deliver(False) - pass + # The message is now wrapped and passed on to the recipient. + + return "REPLY", MIMEText("A reply has been received.") def request(self): - pass + + "Hold requests and notify the recipient." + + self._record_and_deliver(True) + + # The message is now wrapped and passed on to the recipient. + + return "REQUEST", MIMEText("A request has been queued.") # Handler registry.