[CalendarServer-changes] [14993] CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jul 24 11:41:36 PDT 2015
Revision: 14993
http://trac.calendarserver.org//changeset/14993
Author: sagen at apple.com
Date: 2015-07-24 11:41:36 -0700 (Fri, 24 Jul 2015)
Log Message:
-----------
Repair certain inbound third-party IMIP mistakes so we can continue to process them.
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py 2015-07-24 17:15:32 UTC (rev 14992)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/inbound.py 2015-07-24 18:41:36 UTC (rev 14993)
@@ -188,6 +188,30 @@
+def sanitizeCalendar(calendar):
+ """
+ Clean up specific issues seen in the wild from third party IMIP capable
+ servers.
+
+ @param calendar: the calendar Component to sanitize
+ @type calendar: L{Component}
+ """
+ # Don't let a missing PRODID prevent the reply from being processed
+ if not calendar.hasProperty("PRODID"):
+ calendar.addProperty(
+ Property(
+ "PRODID", "Unknown"
+ )
+ )
+
+ # For METHOD:REPLY we can remove STATUS properties
+ methodProperty = calendar.getProperty("METHOD")
+ if methodProperty is not None:
+ if methodProperty.value() == "REPLY":
+ calendar.removeAllPropertiesWithName("STATUS")
+
+
+
class MailReceiver(object):
NO_TOKEN = 0
@@ -400,13 +424,7 @@
calendar = Component.fromString(calBody)
event = calendar.mainComponent()
- # Don't let a missing PRODID prevent the reply from being processed
- if not calendar.hasProperty("PRODID"):
- calendar.addProperty(
- Property(
- "PRODID", "Unknown"
- )
- )
+ sanitizeCalendar(calendar)
calendar.removeAllButOneAttendee(record.attendee)
organizerProperty = calendar.getOrganizerProperty()
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py 2015-07-24 17:15:32 UTC (rev 14992)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_inbound.py 2015-07-24 18:41:36 UTC (rev 14993)
@@ -29,6 +29,7 @@
from txdav.caldav.datastore.scheduling.imip.inbound import injectMessage
from txdav.caldav.datastore.scheduling.imip.inbound import shouldDeleteAllMail
from txdav.caldav.datastore.scheduling.imip.inbound import IMAP4DownloadProtocol
+from txdav.caldav.datastore.scheduling.imip.inbound import sanitizeCalendar
from txdav.common.datastore.test.util import CommonCommonTests
from twext.enterprise.jobqueue import JobItem
@@ -484,7 +485,35 @@
self.assertTrue(result is None)
+ def test_sanitizeCalendar(self):
+ """
+ Verify certain inbound third party mistakes are corrected.
+ """
+ data = """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890
+DTSTAMP:20130208T120000Z
+DTSTART:20180601T120000Z
+DTEND:20180601T130000Z
+ORGANIZER:urn:x-uid:user01
+ATTENDEE:mailto:xyzzy at example.com;PARTSTAT=ACCEPTED
+STATUS:ACCEPTED
+STATUS:ACCEPTED
+END:VEVENT
+END:VCALENDAR
+"""
+ calendar = Component.fromString(data)
+ sanitizeCalendar(calendar)
+ self.assertTrue(calendar.hasProperty("PRODID"))
+ self.assertFalse(calendar.hasProperty("STATUS"))
+
+
+
+
+
class StubFactory(object):
def __init__(self, actionTaken, deleteAllMail):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150724/71be80f3/attachment.html>
More information about the calendarserver-changes
mailing list