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

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 7 11:59:01 PST 2010


Revision: 6675
          http://trac.macosforge.org/projects/calendarserver/changeset/6675
Author:   sagen at apple.com
Date:     2010-12-07 11:58:58 -0800 (Tue, 07 Dec 2010)
Log Message:
-----------
When sending out an iMIP message, convert any "internal" CUAs into mailto: if we have them.  8542992

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/mail.py
    CalendarServer/trunk/twistedcaldav/test/test_mail.py

Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py	2010-12-07 05:33:59 UTC (rev 6674)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2010-12-07 19:58:58 UTC (rev 6675)
@@ -842,6 +842,8 @@
         icaluid = component.propertyValue("UID")
         method = calendar.propertyValue("METHOD")
 
+        # Clean up the attendee list which is purely used within the human
+        # readable email message (not modifying the calendar body)
         attendees = []
         for attendeeProp in calendar.getAllAttendeeProperties():
             params = attendeeProp.params()
@@ -854,11 +856,16 @@
                     if not cn:
                         cn = mailto
                 else:
-                    mailto = None
+                    emailAddress = params.get("EMAIL", (None,))[0]
+                    if emailAddress:
+                        mailto = emailAddress
+                    else:
+                        mailto = None
 
                 if cn or mailto:
                     attendees.append( (cn, mailto) )
 
+
         toAddr = recipient
         if not recipient.startswith("mailto:"):
             raise ValueError("ATTENDEE address '%s' must be mailto: for iMIP operation." % (recipient,))
@@ -927,6 +934,20 @@
             orgCN = calendar.getOrganizerProperty().params().get('CN', (None,))[0]
             addressWithToken = formattedFrom
 
+
+        # Now prevent any "internal" CUAs from being exposed by converting
+        # to mailto: if we have one
+        for attendeeProp in calendar.getAllAttendeeProperties():
+            params = attendeeProp.params()
+            cutype = params.get('CUTYPE', (None,))[0]
+            if cutype == "INDIVIDUAL":
+                cuaddr = normalizeCUAddr(attendeeProp.value())
+                if not cuaddr.startswith("mailto:"):
+                    emailAddress = params.get("EMAIL", (None,))[0]
+                    if emailAddress:
+                        attendeeProp.setValue("mailto:%s" % (emailAddress,))
+
+
         msgId, message = self.generateEmail(inviteState, calendar, orgEmail,
             orgCN, attendees, formattedFrom, addressWithToken, recipient,
             language=language)

Modified: CalendarServer/trunk/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_mail.py	2010-12-07 05:33:59 UTC (rev 6674)
+++ CalendarServer/trunk/twistedcaldav/test/test_mail.py	2010-12-07 19:58:58 UTC (rev 6675)
@@ -166,7 +166,7 @@
                 "The Organizer",
                 [
                     (u'The Attendee', u'attendee at example.com'),
-                    (u'The Organizer', None)
+                    (u'The Organizer', u'organizer at example.com')
                 ],
                 "The Organizer <organizer at example.com>",
                 "attendee at example.com",
@@ -196,7 +196,7 @@
                 "The Organizer",
                 [
                     (u'The Attendee', u'attendee at example.com'),
-                    (u'The Organizer', None)
+                    (u'The Organizer', u'organizer at example.com')
                 ],
                 "The Organizer <organizer at example.com>",
                 "attendee at example.com",
@@ -211,7 +211,7 @@
 UID:DFDD5E46-4F74-478A-9311-B3FF905449C4
 DTSTART:20100325T154500Z
 DTEND:20100325T164500Z
-ATTENDEE;CN=The Attendee;CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:attendee at example.com
+ATTENDEE;CN=The Attendee;CUTYPE=INDIVIDUAL;EMAIL=attendee at example.com;PARTSTAT=ACCEPTED:urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A
 ORGANIZER;CN=The Organizer;EMAIL=organizer at example.com:mailto:organizer at example.com
 SUMMARY:testing outbound( ) *reply*
 END:VEVENT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101207/177f61aa/attachment.html>


More information about the calendarserver-changes mailing list