# HG changeset patch # User Paul Boddie # Date 1414103132 -7200 # Node ID 87086ecd0c903366cd3c83f5348e0c76c8ce6867 # Parent 1e301f44507caa7b390f5efdf623211a3e2eafce Handle replies by delivering incoming messages. diff -r 1e301f44507c -r 87086ecd0c90 imiptools/handlers/person.py --- a/imiptools/handlers/person.py Thu Oct 23 22:24:17 2014 +0200 +++ b/imiptools/handlers/person.py Fri Oct 24 00:25:32 2014 +0200 @@ -39,19 +39,11 @@ def refresh(self): pass - def reply(self): - - "Since this handler does not send requests, it will not handle replies." - - pass - - def request(self): - - "Hold requests and notify the recipient." + def _record_and_deliver(self, queue=False): oa = self.require_organiser_and_attendees() if not oa: - return None + return False (organiser, organiser_attr), attendees = oa @@ -62,13 +54,32 @@ if not self.have_new_object(attendee, "VEVENT"): continue - # Store the event and queue the request. + # Store the event and queue any request. self.store.set_event(attendee, self.uid, to_node( {"VEVENT" : [(self.details, {})]} )) - self.store.queue_request(attendee, self.uid) + if queue: + self.store.queue_request(attendee, self.uid) + + return True + + def reply(self): + + "Record replies and notify the recipient." + + self._record_and_deliver(False) + + # The message is now wrapped and passed on to the recipient. + + return "REPLY", MIMEText("A reply has been received.") + + def request(self): + + "Hold requests and notify the recipient." + + self._record_and_deliver(True) # The message is now wrapped and passed on to the recipient.