[CalendarServer-changes] [2902] CalendarServer/branches/users/sagen/mailgateway-2881

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 28 16:28:35 PDT 2008


Revision: 2902
          http://trac.macosforge.org/projects/calendarserver/changeset/2902
Author:   sagen at apple.com
Date:     2008-08-28 16:28:35 -0700 (Thu, 28 Aug 2008)
Log Message:
-----------
REQUEST-STATUS now encoded correctly; will commit this patch to vobject svn soon.

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py

Added Paths:
-----------
    CalendarServer/branches/users/sagen/mailgateway-2881/lib-patches/vobject/vobject.icalendar.patch

Added: CalendarServer/branches/users/sagen/mailgateway-2881/lib-patches/vobject/vobject.icalendar.patch
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-2881/lib-patches/vobject/vobject.icalendar.patch	                        (rev 0)
+++ CalendarServer/branches/users/sagen/mailgateway-2881/lib-patches/vobject/vobject.icalendar.patch	2008-08-28 23:28:35 UTC (rev 2902)
@@ -0,0 +1,60 @@
+Index: vobject/icalendar.py
+===================================================================
+--- vobject/icalendar.py	(revision 208)
++++ vobject/icalendar.py	(working copy)
+@@ -777,22 +777,27 @@
+     After transformation, value is a list of strings.
+     
+     """
++    listSeparator = ","
+ 
+-    @staticmethod
+-    def decode(line):
++    @classmethod
++    def decode(cls, line):
+         """Remove backslash escaping from line.value, then split on commas."""
+         if line.encoded:
+-            line.value = stringToTextValues(line.value)
++            line.value = stringToTextValues(line.value,
++                listSeparator=cls.listSeparator)
+             line.encoded=False
+     
+-    @staticmethod
+-    def encode(line):
++    @classmethod
++    def encode(cls, line):
+         """Backslash escape line.value."""
+         if not line.encoded:
+-            line.value = ','.join(backslashEscape(val) for val in line.value)
++            line.value = cls.listSeparator.join(backslashEscape(val) for val in line.value)
+             line.encoded=True
+     
+ 
++class SemicolonMultiTextBehavior(MultiTextBehavior):
++    listSeparator = ";"
++
+ #------------------------ Registered Behavior subclasses -----------------------
+ class VCalendar2_0(VCalendarComponentBehavior):
+     """vCalendar 2.0 behavior. With added VAVAILABILITY support."""
+@@ -804,6 +809,7 @@
+                      'METHOD':        (0, 1, None),
+                      'VERSION':       (0, 1, None),#required, but auto-generated
+                      'PRODID':        (1, 1, None),
++                     'REQUEST-STATUS': (0, None, None),
+                      'VTIMEZONE':     (0, None, None),
+                      'VEVENT':        (0, None, None),
+                      'VTODO':         (0, None, None),
+@@ -1481,11 +1487,12 @@
+ 
+ textList = ['CALSCALE', 'METHOD', 'PRODID', 'CLASS', 'COMMENT', 'DESCRIPTION',
+             'LOCATION', 'STATUS', 'SUMMARY', 'TRANSP', 'CONTACT', 'RELATED-TO',
+-            'UID', 'ACTION', 'REQUEST-STATUS', 'BUSYTYPE']
++            'UID', 'ACTION', 'BUSYTYPE']
+ map(lambda x: registerBehavior(TextBehavior, x), textList)
+ 
+ multiTextList = ['CATEGORIES', 'RESOURCES']
+ map(lambda x: registerBehavior(MultiTextBehavior, x), multiTextList)
++registerBehavior(SemicolonMultiTextBehavior, 'REQUEST-STATUS')
+ 
+ #------------------------ Serializing helper functions -------------------------
+ 

Modified: CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py	2008-08-28 21:03:55 UTC (rev 2901)
+++ CalendarServer/branches/users/sagen/mailgateway-2881/twistedcaldav/mail.py	2008-08-28 23:28:35 UTC (rev 2902)
@@ -555,8 +555,15 @@
         attendee = str(attendee)
         calendar.removeAllButOneAttendee(attendee)
         calendar.getOrganizerProperty().setValue(organizer)
-        calendar.addProperty(Property("REQUEST-STATUS",
-            "5.1;Service unavailable"))
+        for comp in calendar.subcomponents():
+            if comp.name() == "VEVENT":
+                comp.addProperty(Property("REQUEST-STATUS",
+                    ["5.1", "Service unavailable"]))
+                break
+        else:
+            # no VEVENT in the calendar body.
+            # TODO: what to do in this case?
+            pass
 
         self.log_error("Mail gateway processing DSN %s" % (msgId,))
         return fn(organizer, attendee, calendar, msgId)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080828/6930429e/attachment.html 


More information about the calendarserver-changes mailing list