[CalendarServer-changes] [10330] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 25 14:27:45 PST 2013


Revision: 10330
          http://trac.calendarserver.org//changeset/10330
Author:   cdaboo at apple.com
Date:     2013-01-25 14:27:45 -0800 (Fri, 25 Jan 2013)
Log Message:
-----------
Make sure per-attendee X- properties are preserved.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
    CalendarServer/trunk/twistedcaldav/scheduling/itip.py
    CalendarServer/trunk/twistedcaldav/stdconfig.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2013-01-25 22:25:36 UTC (rev 10329)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2013-01-25 22:27:45 UTC (rev 10330)
@@ -506,11 +506,13 @@
         self._transferProperty("TRANSP", serverComponent, clientComponent)
         self._transferProperty("DTSTAMP", serverComponent, clientComponent)
         self._transferProperty("LAST-MODIFIED", serverComponent, clientComponent)
-        self._transferProperty("X-APPLE-NEEDS-REPLY", serverComponent, clientComponent)
         self._transferProperty("COMPLETED", serverComponent, clientComponent)
+        for pname in config.Scheduling.CalDAV.PerAttendeeProperties:
+            self._transferProperty(pname, serverComponent, clientComponent)
 
         # Dropbox - this now never returns false
-        self._transferDropBoxData(serverComponent, clientComponent)
+        if config.EnableDropBox:
+            self._transferDropBoxData(serverComponent, clientComponent)
 
         # Handle VALARMs
         serverComponent.removeAlarms()

Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2013-01-25 22:25:36 UTC (rev 10329)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2013-01-25 22:27:45 UTC (rev 10330)
@@ -119,6 +119,11 @@
             organizer_schedule_status = organizer.parameterValue("SCHEDULE-STATUS", None) if organizer else None
             attendee = current_master.getAttendeeProperty((recipient,))
             attendee_dtstamp = attendee.parameterValue("X-CALENDARSERVER-DTSTAMP") if attendee else None
+            other_props = {}
+            for pname in config.Scheduling.CalDAV.PerAttendeeProperties:
+                props = tuple(current_master.properties(pname))
+                if props:
+                    other_props[pname] = props
         else:
             master_valarms = ()
             private_comments = ()
@@ -126,6 +131,7 @@
             completeds = ()
             organizer_schedule_status = None
             attendee_dtstamp = None
+            other_props = {}
 
         if itip_message.masterComponent() is not None:
 
@@ -150,11 +156,13 @@
                 attendee = master_component.getAttendeeProperty((recipient,))
                 if attendee:
                     attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
+            for props in other_props.values():
+                [master_component.replaceProperty(prop) for prop in props]
 
             # Now try to match recurrences in the new calendar
             for component in tuple(new_calendar.subcomponents()):
                 if component.name() != "VTIMEZONE" and component.getRecurrenceIDUTC() is not None:
-                    iTipProcessing.transferItems(calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, component, recipient)
+                    iTipProcessing.transferItems(calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, component, recipient)
 
             # Now try to match recurrences from the old calendar
             for component in calendar.subcomponents():
@@ -165,7 +173,7 @@
                         new_component = new_calendar.deriveInstance(rid, allowCancelled=allowCancelled)
                         if new_component:
                             new_calendar.addComponent(new_component)
-                            iTipProcessing.transferItems(calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, new_component, recipient)
+                            iTipProcessing.transferItems(calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, new_component, recipient)
 
             # Replace the entire object
             return new_calendar, rids
@@ -182,7 +190,7 @@
                         calendar.addComponent(component)
                 else:
                     component = component.duplicate()
-                    missingDeclined = iTipProcessing.transferItems(calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, component, recipient, remove_matched=True)
+                    missingDeclined = iTipProcessing.transferItems(calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, component, recipient, remove_matched=True)
                     if not missingDeclined:
                         calendar.addComponent(component)
                         if recipient:
@@ -493,7 +501,7 @@
 
 
     @staticmethod
-    def transferItems(from_calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, to_component, recipient, remove_matched=False):
+    def transferItems(from_calendar, master_valarms, private_comments, transps, completeds, organizer_schedule_status, attendee_dtstamp, other_props, to_component, recipient, remove_matched=False):
         """
         Transfer properties from a calendar to a component by first trying to match the component in the original calendar and
         use the properties from that, or use the values provided as arguments (which have been derived from the original calendar's
@@ -533,6 +541,9 @@
 
             if attendee and attendee_dtstamp:
                 attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
+
+            for pname in config.Scheduling.CalDAV.PerAttendeeProperties:
+                [to_component.replaceProperty(prop) for prop in matched.properties(pname)]
         else:
             # Check for incoming DECLINED
             attendee = to_component.getAttendeeProperty((recipient,))
@@ -545,6 +556,7 @@
             [to_component.addProperty(comment) for comment in private_comments]
             [to_component.replaceProperty(transp) for transp in transps]
             [to_component.replaceProperty(completed) for completed in completeds]
+
             if organizer_schedule_status:
                 organizer = to_component.getProperty("ORGANIZER")
                 if organizer:
@@ -554,6 +566,9 @@
                 if attendee:
                     attendee.setParameter("X-CALENDARSERVER-DTSTAMP", attendee_dtstamp)
 
+            for props in other_props.values():
+                [to_component.replaceProperty(prop) for prop in props]
+
         return False
 
 

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-01-25 22:25:36 UTC (rev 10329)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-01-25 22:27:45 UTC (rev 10330)
@@ -628,6 +628,13 @@
             "OldDraftCompatibility"      : True, # Whether to maintain compatibility with non-implicit mode
             "ScheduleTagCompatibility"   : True, # Whether to support older clients that do not use Schedule-Tag feature
             "EnablePrivateComments"      : True, # Private comments from attendees to organizer
+            "PerAttendeeProperties"      : [     # Names of iCalendar properties that are preserved when an Attendee does an invite PUT
+                "X-APPLE-NEEDS-REPLY",
+                "X-APPLE-TRAVEL-DURATION",
+                "X-APPLE-TRAVEL-START",
+                "X-APPLE-TRAVEL-RETURN-DURATION",
+                "X-APPLE-TRAVEL-RETURN",
+            ],
         },
 
         "iSchedule": {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130125/56df2d3d/attachment.html>


More information about the calendarserver-changes mailing list