[CalendarServer-changes] [2847] CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/ scheduling/itip.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 22 21:10:45 PDT 2008


Revision: 2847
          http://trac.macosforge.org/projects/calendarserver/changeset/2847
Author:   cdaboo at apple.com
Date:     2008-08-22 21:10:45 -0700 (Fri, 22 Aug 2008)
Log Message:
-----------
Do specific filtering of properties/parameters in an iTIP message.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py

Modified: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py	2008-08-22 19:39:01 UTC (rev 2846)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/itip.py	2008-08-23 04:10:45 UTC (rev 2847)
@@ -353,11 +353,11 @@
         # Now filter out components that do not contain every attendee
         itip.attendeesView(attendees)
         
-        # No alarms
-        itip.removeAlarms()
+        # Strip out unwanted bits
+        iTipGenerator.prepareSchedulingMessage(itip)
 
         return itip
-
+        
     @staticmethod
     def generateAttendeeReply(original, attendee, force_decline=False):
 
@@ -379,6 +379,7 @@
             "DTSTAMP",
             "ORGANIZER",
             "ATTENDEE",
+            "X-CALENDARSERVER-PRIVATE-COMMENT",
         ))
         
         # Now set each ATTENDEE's PARTSTAT to DECLINED
@@ -392,3 +393,51 @@
                     attendeeProp.params()["PARTSTAT"] = ["DECLINED"]
         
         return itip
+
+    @staticmethod
+    def prepareSchedulingMessage(itip):
+        """
+        Remove properties and parameters that should not be sent in an iTIP message
+        """
+
+        # Component properties
+        def stripSubComponents(component, strip):
+            
+            for subcomponent in tuple(component.subcomponents()):
+                if subcomponent.name() in strip:
+                    component.removeComponent(subcomponent)
+
+        # Component properties
+        def stripComponentProperties(component, properties):
+            
+            for property in tuple(component.properties()):
+                if property.name() in properties:
+                    component.removeProperty(property)
+
+        # Property parameters
+        def stripPropertyParameters(properties, parameters):
+            
+            for property in properties:
+                for parameter in parameters:
+                    try:
+                        del property.params()[parameter]
+                    except KeyError:
+                        pass
+
+        # Top-level properties
+        stripComponentProperties(itip, ("X-CALENDARSERVER-ACCESS",))
+                
+        # Component properties
+        for component in itip.subcomponents():
+            stripSubComponents(component, ("VALARM",))
+            stripComponentProperties(component, (
+                "X-CALENDARSERVER-PRIVATE-COMMENT",
+                "X-CALENDARSERVER-ATTENDEE-COMMENT",
+            ))
+            stripPropertyParameters(component.properties("ATTENDEE"), (
+                "SCHEDULE-AGENT",
+                "SCHEDULE-STATUS",
+            ))
+        
+        # No alarms
+        itip.removeAlarms()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080822/dd4226d3/attachment.html 


More information about the calendarserver-changes mailing list