imip-agent

Changeset

835:6e83b9a9a609
2015-10-14 Paul Boddie raw files shortlog changelog graph Added initial support for publishing events to their senders' addresses, thus keeping mail/calendar clients updated about SEQUENCE changes.
imipweb/resource.py (file)
     1.1 --- a/imipweb/resource.py	Wed Oct 14 14:55:02 2015 +0200
     1.2 +++ b/imipweb/resource.py	Wed Oct 14 14:56:05 2015 +0200
     1.3 @@ -259,12 +259,22 @@
     1.4  
     1.5      def _send_message(self, sender, recipients, parts):
     1.6  
     1.7 -        # Explicitly specify the outgoing BCC recipient since we are sending as
     1.8 -        # the generic calendar user.
     1.9 +        """
    1.10 +        Send a message, explicitly specifying the 'sender' as an outgoing BCC
    1.11 +        recipient since the generic calendar user will be the actual sender.
    1.12 +        """
    1.13  
    1.14          message = self.messenger.make_outgoing_message(parts, recipients, outgoing_bcc=sender)
    1.15          self.messenger.sendmail(recipients, message.as_string(), outgoing_bcc=sender)
    1.16  
    1.17 +    def _send_message_to_self(self, parts):
    1.18 +
    1.19 +        "Send a message composed of the given 'parts' to the given user."
    1.20 +
    1.21 +        sender = get_address(self.user)
    1.22 +        message = self.messenger.make_outgoing_message(parts, [sender])
    1.23 +        self.messenger.sendmail([sender], message.as_string())
    1.24 +
    1.25      # Action methods.
    1.26  
    1.27      def process_declined_counter(self, attendee):
    1.28 @@ -359,6 +369,12 @@
    1.29  
    1.30              self.send_message("CANCEL", get_address(organiser), from_organiser=True)
    1.31  
    1.32 +        # Since the organiser can update the SEQUENCE but this can leave any
    1.33 +        # mail/calendar client lagging, issue a PUBLISH message to the user's
    1.34 +        # address.
    1.35 +
    1.36 +        self._send_message_to_self([self.obj.to_part("PUBLISH")])
    1.37 +
    1.38          return True
    1.39  
    1.40  class FormUtilities: