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

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 8 14:45:59 PST 2011


Revision: 6913
          http://trac.macosforge.org/projects/calendarserver/changeset/6913
Author:   sagen at apple.com
Date:     2011-02-08 14:45:57 -0800 (Tue, 08 Feb 2011)
Log Message:
-----------
Handle uppercase MAILTO: as seen from Outlook at CalConnect interop.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/principal.py
    CalendarServer/trunk/twistedcaldav/mail.py
    CalendarServer/trunk/twistedcaldav/scheduling/delivery.py
    CalendarServer/trunk/twistedcaldav/scheduling/imip.py
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
    CalendarServer/trunk/twistedcaldav/scheduling/test/test_imip.py

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2011-02-08 19:34:33 UTC (rev 6912)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2011-02-08 22:45:57 UTC (rev 6913)
@@ -926,7 +926,7 @@
                 self.record.service.calendarHomesCollection.url(),
                 uidsResourceName,
                 self.record.uid
-            )
+            ) + "/"
         url = self.calendarHomeURL
         if url is None:
             return None
@@ -951,7 +951,7 @@
                 self.record.service.addressBookHomesCollection.url(),
                 uidsResourceName,
                 self.record.uid
-            )
+            ) + "/"
         url = self.addressBookHomeURL
         if url is None:
             return None

Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py	2011-02-08 19:34:33 UTC (rev 6912)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2011-02-08 22:45:57 UTC (rev 6913)
@@ -853,6 +853,7 @@
                     attendees.append( (cn, mailto) )
 
 
+        recipient = recipient.lower()
         toAddr = recipient
         if not recipient.startswith("mailto:"):
             raise ValueError("ATTENDEE address '%s' must be mailto: for iMIP operation." % (recipient,))
@@ -909,12 +910,13 @@
 
         else: # REPLY
             inviteState = "reply"
+            originator = originator.lower()
             if not originator.startswith("mailto:"):
                 raise ValueError("Originator address '%s' must be mailto: for REPLY." % (originator,))
             formattedFrom = fromAddr = originator = originator[7:]
 
             organizerMailto = str(calendar.getOrganizer())
-            if not organizerMailto.startswith("mailto:"):
+            if not organizerMailto.lower().startswith("mailto:"):
                 raise ValueError("ORGANIZER address '%s' must be mailto: for REPLY." % (organizerMailto,))
             orgEmail = organizerMailto[7:]
 

Modified: CalendarServer/trunk/twistedcaldav/scheduling/delivery.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/delivery.py	2011-02-08 19:34:33 UTC (rev 6912)
+++ CalendarServer/trunk/twistedcaldav/scheduling/delivery.py	2011-02-08 22:45:57 UTC (rev 6913)
@@ -50,7 +50,8 @@
 
     @classmethod
     def matchCalendarUserAddress(cls, cuaddr):
-        
+
+        cuaddr = cuaddr.lower()
         # Do the pattern match
         for pattern in config.Scheduling[cls.serviceType()]["AddressPatterns"]:
             try:

Modified: CalendarServer/trunk/twistedcaldav/scheduling/imip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/imip.py	2011-02-08 19:34:33 UTC (rev 6912)
+++ CalendarServer/trunk/twistedcaldav/scheduling/imip.py	2011-02-08 22:45:57 UTC (rev 6913)
@@ -81,7 +81,7 @@
 
             for recipient in self.recipients:
                 try:
-                    toAddr = str(recipient.cuaddr)
+                    toAddr = str(recipient.cuaddr).lower()
                     if not toAddr.startswith("mailto:"):
                         raise ValueError("ATTENDEE address '%s' must be mailto: for iMIP operation." % (toAddr,))
 

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2011-02-08 19:34:33 UTC (rev 6912)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2011-02-08 22:45:57 UTC (rev 6913)
@@ -881,7 +881,7 @@
         is_server = self.calendar.getOrganizerScheduleAgent()
         local_organizer = isinstance(self.organizerAddress, LocalCalendarUser)
 
-        if config.Scheduling.iMIP.Enabled and self.organizerAddress.cuaddr.startswith("mailto:"):
+        if config.Scheduling.iMIP.Enabled and self.organizerAddress.cuaddr.lower().startswith("mailto:"):
             return True
 
         if not local_organizer and is_server:

Modified: CalendarServer/trunk/twistedcaldav/scheduling/test/test_imip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/test/test_imip.py	2011-02-08 19:34:33 UTC (rev 6912)
+++ CalendarServer/trunk/twistedcaldav/scheduling/test/test_imip.py	2011-02-08 22:45:57 UTC (rev 6913)
@@ -22,6 +22,7 @@
 from twistedcaldav.scheduling.itip import iTIPRequestStatus
 from twistedcaldav.scheduling.scheduler import ScheduleResponseQueue
 import twistedcaldav.test.util
+from twistedcaldav.config import config
 
 class iMIPProcessing (twistedcaldav.test.util.TestCase):
     """
@@ -60,3 +61,10 @@
         
         self.assertEqual(len(responses.responses), 1)
         self.assertEqual(str(responses.responses[0].children[1]), iTIPRequestStatus.SERVICE_UNAVAILABLE)
+
+
+    def test_matchCalendarUserAddress(self):
+        # iMIP not sensitive to case:
+        self.patch(config.Scheduling[ScheduleViaIMip.serviceType()], "AddressPatterns", ["mailto:.*"])
+        self.assertTrue(ScheduleViaIMip.matchCalendarUserAddress("mailto:user at xyzexample.com"))
+        self.assertTrue(ScheduleViaIMip.matchCalendarUserAddress("MAILTO:user at xyzexample.com"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110208/b4cae18c/attachment-0001.html>


More information about the calendarserver-changes mailing list