From 5ca67f5b8e1c96e01fff2aa1fa09536ad0d94dbb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 2 Nov 2011 21:20:02 +0000 Subject: [PATCH] Monotone-Parent: 1b807c65d09c64e8b6e6a775dbaaad3db3150dd6 Monotone-Revision: c16aa62954764e28a982189ae9222645f4705921 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-11-02T21:20:02 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 ++- OpenChange/MAPIStoreCalendarMessage.m | 37 +++++++++++++++------------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9466d0795..32a703693 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,8 @@ events based on the value of PidLidAppointmentSubType. Don't add the timezone component to the vCalendar in that case. Take PidLidAppointmentStateFlags into account before building the - list of attendees. + list of attendees. Take the organizer passed in the recipients + into account when specified. 2011-11-01 Wolfgang Sourdeau diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index c79f457c6..174d33f65 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -842,33 +842,37 @@ for (i = 0; i < [recipients count]; i++) { dict = [recipients objectAtIndex: i]; - attEmail = [dict objectForKey: @"email"]; - /* Work-around: it happens that Outlook still passes the - organizer as a recipient, maybe because of a feature - documented in a pre-mesozoic PDF still buried in a cavern... - In that case we remove it, and we keep the number of - effective recipients in "effective". If the total is 0, we - remove the "ORGANIZER" too. */ - if ([attEmail isEqualToString: orgEmail]) - continue; - - effective++; flags = [dict objectForKey: MAPIPropertyKey (PR_RECIPIENT_FLAGS)]; if (!flags) { - [self logWithFormat: @"no recipient flags specified"]; - break; + [self logWithFormat: + @"no recipient flags specified: skipping recipient"]; + continue; } person = [iCalPerson new]; [person setCn: [dict objectForKey: @"fullName"]]; + attEmail = [dict objectForKey: @"email"]; [person setEmail: attEmail]; if (([flags unsignedIntValue] & 0x0002)) /* recipOrganizer */ [newEvent setOrganizer: person]; else { + /* Work-around: it happens that Outlook still passes the + organizer as a recipient, maybe because of a feature + documented in a pre-mesozoic PDF still buried in a + cavern... In that case we remove it, and we keep the + number of effective recipients in "effective". If the + total is 0, we remove the "ORGANIZER" too. */ + if ([attEmail isEqualToString: orgEmail]) + { + [self logWithFormat: + @"avoiding setting organizer as recipient"]; + continue; + } + trackStatus = [dict objectForKey: MAPIPropertyKey (PR_RECIPIENT_TRACKSTATUS)]; @@ -894,13 +898,14 @@ [person setRsvp: @"TRUE"]; [person setRole: @"REQ-PARTICIPANT"]; [newEvent addToAttendees: person]; + effective++; } - if (effective == 0) /* See work-around above */ - [newEvent setOrganizer: nil]; - [person release]; } + + if (effective == 0) /* See work-around above */ + [newEvent setOrganizer: nil]; } }