imip-agent

Changeset

848:4530fda4bc4f
2015-10-16 Paul Boddie raw files shortlog changelog graph Strip SENT-BY from other participants when sending messages.
imiptools/data.py (file) imipweb/resource.py (file)
     1.1 --- a/imiptools/data.py	Fri Oct 16 16:11:01 2015 +0200
     1.2 +++ b/imiptools/data.py	Fri Oct 16 16:11:43 2015 +0200
     1.3 @@ -442,6 +442,14 @@
     1.4          self["SEQUENCE"] = [(str(int(sequence) + (increment and 1 or 0)), {})]
     1.5          return sequence
     1.6  
     1.7 +    def update_senders(self, user=None):
     1.8 +
     1.9 +        "Remove SENT-BY attributes from properties."
    1.10 +
    1.11 +        for identity, attr in self.get_items("ATTENDEE") or []:
    1.12 +            if attr.has_key("SENT-BY") and (not user or get_uri(identity) != user):
    1.13 +                del attr["SENT-BY"]
    1.14 +
    1.15      def update_exceptions(self, excluded):
    1.16  
    1.17          """
     2.1 --- a/imipweb/resource.py	Fri Oct 16 16:11:01 2015 +0200
     2.2 +++ b/imipweb/resource.py	Fri Oct 16 16:11:43 2015 +0200
     2.3 @@ -289,6 +289,7 @@
     2.4              return False
     2.5  
     2.6          method = "DECLINECOUNTER"
     2.7 +        obj.update_senders()
     2.8          obj.update_dtstamp()
     2.9          obj.update_sequence(False)
    2.10          self._send_message(get_address(self.user), [get_address(attendee)], parts=[obj.to_part(method)])
    2.11 @@ -312,6 +313,8 @@
    2.12  
    2.13          if not changed:
    2.14              self.obj["ATTENDEE"] = [(self.user, attendee_attr)]
    2.15 +        else:
    2.16 +            self.obj.update_senders(self.user)
    2.17  
    2.18          self.update_dtstamp()
    2.19          self.update_sequence(False)
    2.20 @@ -336,6 +339,7 @@
    2.21          organiser, organiser_attr = uri_item(self.obj.get_item("ORGANIZER"))
    2.22  
    2.23          self.update_sender(organiser_attr)
    2.24 +        self.obj.update_senders()
    2.25          self.update_dtstamp()
    2.26          self.update_sequence(True)
    2.27