[CalendarServer-changes] [7667] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 24 16:26:53 PDT 2011
Revision: 7667
http://trac.macosforge.org/projects/calendarserver/changeset/7667
Author: sagen at apple.com
Date: 2011-06-24 16:26:52 -0700 (Fri, 24 Jun 2011)
Log Message:
-----------
For iMIP REPLY sending, use mailto: from the calendar data.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/mail.py
CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
CalendarServer/trunk/twistedcaldav/test/test_mail.py
Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py 2011-06-24 22:05:57 UTC (rev 7666)
+++ CalendarServer/trunk/twistedcaldav/mail.py 2011-06-24 23:26:52 UTC (rev 7667)
@@ -898,6 +898,7 @@
addressWithToken = "%s+%s@%s" % (pre, token, post)
organizerProperty = calendar.getOrganizerProperty()
+ organizerEmailAddress = organizerProperty.parameterValue("EMAIL", None)
organizerValue = organizerProperty.value()
organizerProperty.setValue("mailto:%s" % (addressWithToken,))
@@ -910,8 +911,8 @@
# The email's From will include the originator's real name email
# address if available. Otherwise it will be the server's email
# address (without # + addressing)
- if originator.startswith("mailto:"):
- orgEmail = fromAddr = originator[7:]
+ if organizerEmailAddress:
+ orgEmail = fromAddr = organizerEmailAddress
else:
fromAddr = serverAddress
orgEmail = None
@@ -927,11 +928,16 @@
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:]
+ # Look up the attendee property corresponding to the originator
+ # of this reply
+ originatorAttendeeProperty = calendar.getAttendeeProperty([originator])
+ formattedFrom = fromAddr = originator = ""
+ if originatorAttendeeProperty:
+ originatorAttendeeEmailAddress = originatorAttendeeProperty.parameterValue("EMAIL", None)
+ if originatorAttendeeEmailAddress:
+ formattedFrom = fromAddr = originator = originatorAttendeeEmailAddress
+
organizerMailto = str(calendar.getOrganizer())
if not organizerMailto.lower().startswith("mailto:"):
raise ValueError("ORGANIZER address '%s' must be mailto: for REPLY." % (organizerMailto,))
Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2011-06-24 22:05:57 UTC (rev 7666)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py 2011-06-24 23:26:52 UTC (rev 7667)
@@ -946,7 +946,7 @@
local_organizer = type(self.organizerAddress) in (LocalCalendarUser, PartitionedCalendarUser, OtherServerCalendarUser,)
if config.Scheduling.iMIP.Enabled and self.organizerAddress.cuaddr.lower().startswith("mailto:"):
- return True
+ return is_server
if not local_organizer and is_server:
# Coerce ORGANIZER to SCHEDULE-AGENT=NONE
Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py 2011-06-24 22:05:57 UTC (rev 7666)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py 2011-06-24 23:26:52 UTC (rev 7667)
@@ -174,7 +174,7 @@
originatorPrincipal = (yield self.request.locateResource(originatorPrincipalURL))
if originatorPrincipal:
# Pick the canonical CUA:
- self.originator = originatorPrincipal.canonicalCalendarUserAddress()
+ originator = originatorPrincipal.canonicalCalendarUserAddress()
if not originator:
log.err("%s request must have Originator" % (self.method,))
Modified: CalendarServer/trunk/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_mail.py 2011-06-24 22:05:57 UTC (rev 7666)
+++ CalendarServer/trunk/twistedcaldav/test/test_mail.py 2011-06-24 23:26:52 UTC (rev 7667)
@@ -258,7 +258,7 @@
END:VCALENDAR
""",
"CFDD5E46-4F74-478A-9311-B3FF905449C3",
- "mailto:organizer at example.com",
+ "urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A",
"mailto:attendee at example.com",
"new",
"organizer at example.com",
@@ -288,7 +288,7 @@
END:VCALENDAR
""",
"CFDD5E46-4F74-478A-9311-B3FF905449C3",
- "mailto:organizer at example.com",
+ "urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A",
"mailto:attendee at example.com",
"update",
"organizer at example.com",
@@ -317,7 +317,7 @@
END:VCALENDAR
""",
None,
- "mailto:attendee at example.com",
+ "urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A",
"mailto:organizer at example.com",
"reply",
"organizer at example.com",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110624/72b1e74d/attachment.html>
More information about the calendarserver-changes
mailing list