1.1 --- a/imiptools/handlers/person.py Thu Oct 23 22:24:17 2014 +0200
1.2 +++ b/imiptools/handlers/person.py Fri Oct 24 00:25:32 2014 +0200
1.3 @@ -39,19 +39,11 @@
1.4 def refresh(self):
1.5 pass
1.6
1.7 - def reply(self):
1.8 -
1.9 - "Since this handler does not send requests, it will not handle replies."
1.10 -
1.11 - pass
1.12 -
1.13 - def request(self):
1.14 -
1.15 - "Hold requests and notify the recipient."
1.16 + def _record_and_deliver(self, queue=False):
1.17
1.18 oa = self.require_organiser_and_attendees()
1.19 if not oa:
1.20 - return None
1.21 + return False
1.22
1.23 (organiser, organiser_attr), attendees = oa
1.24
1.25 @@ -62,13 +54,32 @@
1.26 if not self.have_new_object(attendee, "VEVENT"):
1.27 continue
1.28
1.29 - # Store the event and queue the request.
1.30 + # Store the event and queue any request.
1.31
1.32 self.store.set_event(attendee, self.uid, to_node(
1.33 {"VEVENT" : [(self.details, {})]}
1.34 ))
1.35
1.36 - self.store.queue_request(attendee, self.uid)
1.37 + if queue:
1.38 + self.store.queue_request(attendee, self.uid)
1.39 +
1.40 + return True
1.41 +
1.42 + def reply(self):
1.43 +
1.44 + "Record replies and notify the recipient."
1.45 +
1.46 + self._record_and_deliver(False)
1.47 +
1.48 + # The message is now wrapped and passed on to the recipient.
1.49 +
1.50 + return "REPLY", MIMEText("A reply has been received.")
1.51 +
1.52 + def request(self):
1.53 +
1.54 + "Hold requests and notify the recipient."
1.55 +
1.56 + self._record_and_deliver(True)
1.57
1.58 # The message is now wrapped and passed on to the recipient.
1.59