# HG changeset patch # User Paul Boddie # Date 1423060203 -3600 # Node ID c7215c263cb3ea5a5f5324e94c1bbc6d621f7776 # Parent aa62dbcee6e3671fe906a67aacad8f32c5a53637 Separated organiser and attendee actions, adding some support for cancellations. diff -r aa62dbcee6e3 -r c7215c263cb3 imip_manager.py --- a/imip_manager.py Wed Feb 04 15:16:02 2015 +0100 +++ b/imip_manager.py Wed Feb 04 15:30:03 2015 +0100 @@ -192,11 +192,12 @@ return False - def process_created_request(self, update=False): + def process_created_request(self, method, update=False): """ Process the current request for the given 'user', sending a created - request to attendees. Return whether any action was taken. + request of the given 'method' to attendees. Return whether any action + was taken. If 'update' is given, the sequence number will be incremented in order to override any previous message. @@ -211,8 +212,7 @@ self.obj["SEQUENCE"] = [(str(int(sequence) + 1), {})] self.update_dtstamp() - self.send_message("REQUEST", get_address(self.organiser), for_organiser=True) - + self.send_message(method, get_address(self.organiser), for_organiser=True) return True class Manager: @@ -478,21 +478,23 @@ accept = args.has_key("accept") decline = args.has_key("decline") + discard = args.has_key("discard") invite = args.has_key("invite") + cancel = args.has_key("cancel") update = not queued and args.has_key("update") - if accept or decline or invite: + if accept or decline or invite or cancel: handler = ManagerHandler(obj, self.user, self.messenger) # Process the object and remove it from the list of requests. if (accept or decline) and handler.process_received_request(accept, update) or \ - invite and handler.process_created_request(update): + (invite or cancel) and handler.process_created_request(invite and "REQUEST" or "CANCEL", update): self.remove_request(uid) - elif args.has_key("discard"): + elif discard: # Remove the request and the object. @@ -536,33 +538,39 @@ else: page.p("This request has not yet been dealt with.") - if needs_update: - page.p("This request can be updated as follows:") - else: - page.p("An action is required for this request:") - - page.p() - # Show appropriate options depending on the role of the user. - if is_organiser: - page.input(name="invite", type="submit", value="Invite") + if is_attendee: + if needs_update: + page.p("This request can be updated as follows:") + else: + page.p("An action is required for this request:") - if is_attendee: + page.p() page.input(name="accept", type="submit", value="Accept") page.add(" ") page.input(name="decline", type="submit", value="Decline") + page.add(" ") + page.input(name="discard", type="submit", value="Discard") + page.p.close() - page.add(" ") - page.input(name="discard", type="submit", value="Discard") + if is_organiser: + if needs_update: + page.p("As organiser, you can perform the following:") + else: + page.p("As organiser, you will need to perform an action:") + + page.p() + page.input(name="invite", type="submit", value="Invite") + page.add(" ") + page.input(name="cancel", type="submit", value="Cancel") + page.p.close() # Updated objects need to have details updated upon sending. if needs_update: page.input(name="update", type="hidden", value="true") - page.p.close() - object_labels = { "SUMMARY" : "Summary", "DTSTART" : "Start",