mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-03 20:38:50 +00:00
Monotone-Parent: 3a6e0507a35f90e7be4467763bd26ef4fb15cf80
Monotone-Revision: 5b4e61e92b3d68b92ea25f1513eb120e502250a1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-07-20T15:42:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#import <Appointments/iCalEntityObject+SOGo.h>
|
||||
#import <Mailer/NSString+Mail.h>
|
||||
|
||||
#import "iCalEvent+MAPIStore.h"
|
||||
#import "MAPIStoreAppointmentWrapper.h"
|
||||
#import "MAPIStoreCalendarAttachment.h"
|
||||
#import "MAPIStoreCalendarFolder.h"
|
||||
@@ -103,32 +104,63 @@
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
calendar = nil;
|
||||
masterEvent = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithSOGoObject: (id) newSOGoObject
|
||||
inContainer: (MAPIStoreObject *) newFolder
|
||||
{
|
||||
iCalEvent *event;
|
||||
MAPIStoreContext *context;
|
||||
MAPIStoreUserContext *userContext;
|
||||
iCalCalendar *origCalendar;
|
||||
MAPIStoreAppointmentWrapper *appointmentWrapper;
|
||||
|
||||
|
||||
if ((self = [super initWithSOGoObject: newSOGoObject
|
||||
inContainer: newFolder]))
|
||||
{
|
||||
event = [sogoObject component: NO secure: YES];
|
||||
if ([newSOGoObject isNew])
|
||||
{
|
||||
ASSIGN (calendar, [iCalCalendar groupWithTag: @"vcalendar"]);
|
||||
[calendar setVersion: @"2.0"];
|
||||
[calendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
||||
masterEvent = [iCalEvent groupWithTag: @"vevent"];
|
||||
[calendar addChild: masterEvent];
|
||||
[masterEvent setCreated: [NSCalendarDate date]];
|
||||
}
|
||||
else
|
||||
{
|
||||
origCalendar = [sogoObject calendar: YES secure: YES];
|
||||
calendar = [origCalendar mutableCopy];
|
||||
masterEvent = [[calendar events] objectAtIndex: 0];
|
||||
}
|
||||
context = [self context];
|
||||
userContext = [self userContext];
|
||||
appointmentWrapper
|
||||
= [MAPIStoreAppointmentWrapper wrapperWithICalEvent: event
|
||||
= [MAPIStoreAppointmentWrapper wrapperWithICalEvent: masterEvent
|
||||
andUser: [userContext sogoUser]
|
||||
andSenderEmail: nil
|
||||
inTimeZone: [userContext timeZone]
|
||||
withConnectionInfo: [context connectionInfo]];
|
||||
[self addProxy: appointmentWrapper];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[calendar release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* getters */
|
||||
- (int) getPidLidFInvited: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
@@ -177,6 +209,7 @@
|
||||
instance, but this might not always be true */
|
||||
[[proxies objectAtIndex: 0] fillMessageData: msgData
|
||||
inMemCtx: memCtx];
|
||||
|
||||
*dataPtr = msgData;
|
||||
}
|
||||
|
||||
@@ -209,28 +242,28 @@
|
||||
// - (int) getPidTagReceivedByAddressType: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [[self appointmentWrapper] getPidTagReceivedByAddressType: data
|
||||
// return [appointmentWrapper getPidTagReceivedByAddressType: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedByEmailAddress: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [[self appointmentWrapper] getPidTagReceivedByEmailAddress: data
|
||||
// return [appointmentWrapper getPidTagReceivedByEmailAddress: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedByName: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [[self appointmentWrapper] getPidTagReceivedByName: data
|
||||
// return [appointmentWrapper getPidTagReceivedByName: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
// - (int) getPidTagReceivedByEntryId: (void **) data
|
||||
// inMemCtx: (TALLOC_CTX *) memCtx
|
||||
// {
|
||||
// return [[self appointmentWrapper] getPidTagReceivedByEntryId: data
|
||||
// return [appointmentWrapper getPidTagReceivedByEntryId: data
|
||||
// inMemCtx: memCtx];
|
||||
// }
|
||||
|
||||
@@ -265,28 +298,6 @@
|
||||
return [self getYes: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
/* attendee */
|
||||
- (void) _setupRecurrenceInCalendar: (iCalCalendar *) calendar
|
||||
withEvent: (iCalEvent *) event
|
||||
fromData: (NSData *) mapiRecurrenceData
|
||||
{
|
||||
struct Binary_r *blob;
|
||||
struct AppointmentRecurrencePattern *pattern;
|
||||
NSMutableArray *otherEvents;
|
||||
|
||||
/* cleanup */
|
||||
otherEvents = [[calendar events] mutableCopy];
|
||||
[otherEvents removeObject: event];
|
||||
[calendar removeChildren: otherEvents];
|
||||
[otherEvents release];
|
||||
|
||||
blob = [mapiRecurrenceData asBinaryInMemCtx: NULL];
|
||||
pattern = get_AppointmentRecurrencePattern (blob, blob);
|
||||
[calendar setupRecurrenceWithMasterEntity: event
|
||||
fromRecurrencePattern: &pattern->RecurrencePattern];
|
||||
talloc_free (blob);
|
||||
}
|
||||
|
||||
- (NSString *) _uidFromGlobalObjectId
|
||||
{
|
||||
NSData *objectId;
|
||||
@@ -296,7 +307,8 @@
|
||||
|
||||
/* NOTE: we only handle the generic case at the moment, see
|
||||
MAPIStoreAppointmentWrapper */
|
||||
objectId = [properties objectForKey: MAPIPropertyKey (PidLidGlobalObjectId)];
|
||||
objectId = [properties
|
||||
objectForKey: MAPIPropertyKey (PidLidGlobalObjectId)];
|
||||
if (objectId)
|
||||
{
|
||||
length = [objectId length];
|
||||
@@ -360,50 +372,6 @@
|
||||
ASSIGN (sogoObject, newObject);
|
||||
}
|
||||
|
||||
- (void) _setupAlarmDataInEvent: (iCalEvent *) newEvent
|
||||
{
|
||||
NSArray *alarms;
|
||||
iCalAlarm *currentAlarm, *alarm = nil;
|
||||
iCalTrigger *trigger;
|
||||
NSNumber *delta;
|
||||
NSString *action;
|
||||
NSUInteger count, max;
|
||||
|
||||
/* find and remove first display alarm */
|
||||
alarms = [newEvent alarms];
|
||||
max = [alarms count];
|
||||
for (count = 0; !alarm && count < max; count++)
|
||||
{
|
||||
currentAlarm = [alarms objectAtIndex: count];
|
||||
action = [[currentAlarm action] lowercaseString];
|
||||
if (!action || [action isEqualToString: @"display"])
|
||||
alarm = currentAlarm;
|
||||
}
|
||||
|
||||
if (alarm)
|
||||
[newEvent removeChild: alarm];
|
||||
|
||||
if ([[properties objectForKey: MAPIPropertyKey (PidLidReminderSet)]
|
||||
boolValue])
|
||||
{
|
||||
delta
|
||||
= [properties objectForKey: MAPIPropertyKey (PidLidReminderDelta)];
|
||||
if (delta)
|
||||
{
|
||||
alarm = [iCalAlarm new];
|
||||
[alarm setAction: @"DISPLAY"];
|
||||
trigger = [iCalTrigger elementWithTag: @"trigger"];
|
||||
[trigger setValueType: @"DURATION"];
|
||||
[trigger
|
||||
setSingleValue: [NSString stringWithFormat: @"-PT%@M", delta]
|
||||
forKey: @""];
|
||||
[alarm setTrigger: trigger];
|
||||
[newEvent addToAlarms: alarm];
|
||||
[alarm release];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) subscriberCanReadMessage
|
||||
{
|
||||
NSArray *roles;
|
||||
@@ -429,20 +397,9 @@
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) save
|
||||
{
|
||||
iCalCalendar *vCalendar;
|
||||
BOOL isAllDay;
|
||||
iCalDateTime *start, *end;
|
||||
iCalTimeZone *tz;
|
||||
NSCalendarDate *now;
|
||||
NSString *uid, *content, *tzName, *priority, *newParticipationStatus = nil;
|
||||
iCalEvent *newEvent;
|
||||
// iCalPerson *userPerson;
|
||||
NSUInteger responseStatus = 0;
|
||||
NSInteger tzOffset;
|
||||
SOGoUser *activeUser, *ownerUser;
|
||||
id value;
|
||||
|
||||
if (isNew)
|
||||
{
|
||||
@@ -450,397 +407,31 @@
|
||||
if (uid)
|
||||
{
|
||||
/* Hack required because of what's explained in oxocal 3.1.4.7.1:
|
||||
basically, Outlook creates a copy of the event and then removes the
|
||||
old instance. We perform a trickery to avoid performing those
|
||||
operations in the backend, in a way that enables us to recover the
|
||||
initial instance and act solely on it. */
|
||||
basically, Outlook creates a copy of the event and then removes
|
||||
the old instance. We perform a trickery to avoid performing those
|
||||
operations in the backend, in a way that enables us to recover
|
||||
the initial instance and act solely on it. */
|
||||
[self _fixupAppointmentObjectWithUID: uid];
|
||||
}
|
||||
else
|
||||
uid = [SOGoObject globallyUniqueObjectId];
|
||||
[masterEvent setUid: uid];
|
||||
[sogoObject setNameInContainer:
|
||||
[NSString stringWithFormat: @"%@.ics", uid]];
|
||||
}
|
||||
|
||||
[self logWithFormat: @"-save, event props:"];
|
||||
// [self logWithFormat: @"-save, event props:"];
|
||||
// MAPIStoreDumpMessageProperties (newProperties);
|
||||
|
||||
now = [NSCalendarDate date];
|
||||
// now = [NSCalendarDate date];
|
||||
|
||||
content = [sogoObject contentAsString];
|
||||
if (![content length])
|
||||
{
|
||||
newEvent = [sogoObject component: YES secure: NO];
|
||||
vCalendar = [newEvent parent];
|
||||
[vCalendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
||||
[newEvent setCreated: now];
|
||||
// CREATED = PidTagCreationTime
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidTagCreationTime)];
|
||||
if (value)
|
||||
[newEvent setCreated: value];
|
||||
[newEvent setUid: uid];
|
||||
content = [vCalendar versitString];
|
||||
}
|
||||
activeUser = [[self context] activeUser];
|
||||
[masterEvent updateFromMAPIProperties: properties
|
||||
inUserContext: [self userContext]
|
||||
withActiveUser: activeUser];
|
||||
[sogoObject updateContentWithCalendar: calendar
|
||||
fromRequest: nil];
|
||||
|
||||
vCalendar = [iCalCalendar parseSingleFromSource: content];
|
||||
newEvent = [[vCalendar events] objectAtIndex: 0];
|
||||
|
||||
// DTSTAMP = PidLidOwnerCriticalChange or PidLidAttendeeCriticalChange
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidOwnerCriticalChange)];
|
||||
if (!value || [value isNever])
|
||||
value = now;
|
||||
[newEvent setTimeStampAsDate: value];
|
||||
|
||||
// LAST-MODIFIED = PidTagLastModificationTime
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidTagLastModificationTime)];
|
||||
if (!value)
|
||||
value = now;
|
||||
[newEvent setLastModified: value];
|
||||
|
||||
// summary
|
||||
value = [properties
|
||||
objectForKey: MAPIPropertyKey (PR_NORMALIZED_SUBJECT_UNICODE)];
|
||||
if (value)
|
||||
[newEvent setSummary: value];
|
||||
|
||||
// Location
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidLocation)];
|
||||
if (value)
|
||||
[newEvent setLocation: value];
|
||||
|
||||
isAllDay = [newEvent isAllDay];
|
||||
value = [properties
|
||||
objectForKey: MAPIPropertyKey (PidLidAppointmentSubType)];
|
||||
if (value)
|
||||
isAllDay = [value boolValue];
|
||||
if (!isAllDay)
|
||||
{
|
||||
tzName = [[[self userContext] timeZone] name];
|
||||
tz = [iCalTimeZone timeZoneForName: tzName];
|
||||
[vCalendar addTimeZone: tz];
|
||||
}
|
||||
else
|
||||
tz = nil;
|
||||
|
||||
// start
|
||||
value = [properties objectForKey: MAPIPropertyKey (PR_START_DATE)];
|
||||
if (!value)
|
||||
value = [properties
|
||||
objectForKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
|
||||
if (value)
|
||||
{
|
||||
start = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtstart"];
|
||||
[start setTimeZone: tz];
|
||||
if (isAllDay)
|
||||
{
|
||||
[start setDate: value];
|
||||
[start setTimeZone: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
tzOffset = [[value timeZone] secondsFromGMTForDate: value];
|
||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[start setDateTime: value];
|
||||
}
|
||||
}
|
||||
|
||||
/* end */
|
||||
value = [properties objectForKey: MAPIPropertyKey (PR_END_DATE)];
|
||||
if (!value)
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
|
||||
if (value)
|
||||
{
|
||||
end = (iCalDateTime *) [newEvent uniqueChildWithTag: @"dtend"];
|
||||
[end setTimeZone: tz];
|
||||
if (isAllDay)
|
||||
{
|
||||
[end setDate: value];
|
||||
[end setTimeZone: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
tzOffset = [[value timeZone] secondsFromGMTForDate: value];
|
||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: tzOffset];
|
||||
[end setDateTime: value];
|
||||
}
|
||||
}
|
||||
|
||||
/* priority */
|
||||
value = [properties objectForKey: MAPIPropertyKey(PR_IMPORTANCE)];
|
||||
if (value)
|
||||
{
|
||||
switch ([value intValue])
|
||||
{
|
||||
case 0: // IMPORTANCE_LOW
|
||||
priority = @"9";
|
||||
break;
|
||||
case 2: // IMPORTANCE_HIGH
|
||||
priority = @"1";
|
||||
break;
|
||||
default: // IMPORTANCE_NORMAL
|
||||
priority = @"5";
|
||||
}
|
||||
}
|
||||
else
|
||||
priority = @"0"; // None
|
||||
[newEvent setPriority: priority];
|
||||
|
||||
/* show time as free/busy/tentative/out of office. Possible values are:
|
||||
0x00000000 - olFree
|
||||
0x00000001 - olTentative
|
||||
0x00000002 - olBusy
|
||||
0x00000003 - olOutOfOffice */
|
||||
value = [properties objectForKey: MAPIPropertyKey(PidLidBusyStatus)];
|
||||
if (value)
|
||||
{
|
||||
switch ([value intValue])
|
||||
{
|
||||
case 0:
|
||||
[newEvent setTransparency: @"TRANSPARENT"];
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
[newEvent setTransparency: @"OPAQUE"];
|
||||
}
|
||||
}
|
||||
|
||||
/* Comment */
|
||||
value = [properties objectForKey: MAPIPropertyKey (PR_BODY_UNICODE)];
|
||||
if (!value)
|
||||
{
|
||||
value = [properties objectForKey: MAPIPropertyKey (PR_HTML)];
|
||||
if (value)
|
||||
{
|
||||
value = [[NSString alloc] initWithData: value
|
||||
encoding: NSUTF8StringEncoding];
|
||||
[value autorelease];
|
||||
value = [value htmlToText];
|
||||
}
|
||||
}
|
||||
if (value)
|
||||
{
|
||||
if ([value length] == 0 || [value isEqualToString: @"\\n"])
|
||||
value = nil;
|
||||
[newEvent setComment: value];
|
||||
}
|
||||
|
||||
/* recurrence */
|
||||
value = [properties
|
||||
objectForKey: MAPIPropertyKey (PidLidAppointmentRecur)];
|
||||
if (value)
|
||||
[self _setupRecurrenceInCalendar: vCalendar
|
||||
withEvent: newEvent
|
||||
fromData: value];
|
||||
|
||||
/* alarm */
|
||||
[self _setupAlarmDataInEvent: newEvent];
|
||||
|
||||
// Organizer
|
||||
value = [properties objectForKey: @"recipients"];
|
||||
if (value)
|
||||
{
|
||||
NSArray *recipients;
|
||||
NSDictionary *dict;
|
||||
NSString *orgEmail, *sentBy, *attEmail;
|
||||
iCalPerson *person;
|
||||
iCalPersonPartStat newPartStat;
|
||||
NSNumber *flags, *trackStatus;
|
||||
int i, effective;
|
||||
BOOL organizerIsSet = NO;
|
||||
|
||||
[newEvent setOrganizer: nil];
|
||||
[newEvent removeAllAttendees];
|
||||
|
||||
recipients = [value objectForKey: @"to"];
|
||||
effective = 0;
|
||||
for (i = 0; i < [recipients count]; i++)
|
||||
{
|
||||
dict = [recipients objectAtIndex: i];
|
||||
person = [iCalPerson new];
|
||||
[person setCn: [dict objectForKey: @"fullName"]];
|
||||
attEmail = [dict objectForKey: @"email"];
|
||||
[person setEmail: attEmail];
|
||||
|
||||
flags = [dict objectForKey: MAPIPropertyKey (PR_RECIPIENT_FLAGS)];
|
||||
if (!flags)
|
||||
{
|
||||
[self logWithFormat:
|
||||
@"no recipient flags specified: skipping recipient"];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (([flags unsignedIntValue] & 0x0002)) /* recipOrganizer */
|
||||
{
|
||||
[newEvent setOrganizer: person];
|
||||
organizerIsSet = YES;
|
||||
[self logWithFormat: @"organizer set via recipient flags"];
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL isOrganizer = NO;
|
||||
|
||||
// /* 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 (PidTagRecipientTrackStatus)];
|
||||
if (trackStatus)
|
||||
{
|
||||
/* FIXME: we should provide a data converter between OL
|
||||
partstats and SOGo */
|
||||
switch ([trackStatus unsignedIntValue])
|
||||
{
|
||||
case 0x01: /* respOrganized */
|
||||
isOrganizer = YES;
|
||||
break;
|
||||
case 0x02: /* respTentative */
|
||||
newPartStat = iCalPersonPartStatTentative;
|
||||
break;
|
||||
case 0x03: /* respAccepted */
|
||||
newPartStat = iCalPersonPartStatAccepted;
|
||||
break;
|
||||
case 0x04: /* respDeclined */
|
||||
newPartStat = iCalPersonPartStatDeclined;
|
||||
break;
|
||||
default:
|
||||
newPartStat = iCalPersonPartStatNeedsAction;
|
||||
}
|
||||
|
||||
if (isOrganizer)
|
||||
{
|
||||
[newEvent setOrganizer: person];
|
||||
organizerIsSet = YES;
|
||||
[self logWithFormat: @"organizer set via track status"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[person setParticipationStatus: newPartStat];
|
||||
[person setRsvp: @"TRUE"];
|
||||
[person setRole: @"REQ-PARTICIPANT"];
|
||||
[newEvent addToAttendees: person];
|
||||
effective++;
|
||||
}
|
||||
}
|
||||
else
|
||||
[self errorWithFormat: @"skipped recipient due"
|
||||
@" to missing track status"];
|
||||
}
|
||||
|
||||
[person release];
|
||||
}
|
||||
|
||||
if (effective == 0) /* See work-around above */
|
||||
[newEvent setOrganizer: nil];
|
||||
else
|
||||
{
|
||||
// SEQUENCE = PidLidAppointmentSequence
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentSequence)];
|
||||
if (value)
|
||||
[newEvent setSequence: value];
|
||||
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
if (organizerIsSet)
|
||||
{
|
||||
/* We must reset the participation status to the value
|
||||
obtained from PidLidResponseStatus as the value in
|
||||
PidTagRecipientTrackStatus is not correct. Note (hack):
|
||||
the method used here requires that the user directory
|
||||
from LDAP and Samba matches perfectly. This can be solved
|
||||
more appropriately by making use of the sender
|
||||
properties... */
|
||||
person = [newEvent userAsAttendee: ownerUser];
|
||||
if (person)
|
||||
{
|
||||
value
|
||||
= [properties objectForKey: MAPIPropertyKey (PidLidResponseStatus)];
|
||||
if (value)
|
||||
responseStatus = [value unsignedLongValue];
|
||||
|
||||
/* FIXME: we should provide a data converter between OL partstats and
|
||||
SOGo */
|
||||
switch (responseStatus)
|
||||
{
|
||||
case 0x02: /* respTentative */
|
||||
newPartStat = iCalPersonPartStatTentative;
|
||||
break;
|
||||
case 0x03: /* respAccepted */
|
||||
newPartStat = iCalPersonPartStatAccepted;
|
||||
break;
|
||||
case 0x04: /* respDeclined */
|
||||
newPartStat = iCalPersonPartStatDeclined;
|
||||
break;
|
||||
default:
|
||||
newPartStat = iCalPersonPartStatNeedsAction;
|
||||
}
|
||||
[person setParticipationStatus: newPartStat];
|
||||
newParticipationStatus = [person partStatWithDefault];
|
||||
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAttendeeCriticalChange)];
|
||||
if (value && ![value isNever])
|
||||
[newEvent setTimeStampAsDate: value];
|
||||
// if (newPartStat // != iCalPersonPartStatUndefined
|
||||
// )
|
||||
// {
|
||||
// // iCalPerson *participant;
|
||||
|
||||
// // participant = [newEvent userAsAttendee: ownerUser];
|
||||
// // [participant setParticipationStatus: newPartStat];
|
||||
// // [sogoObject saveComponent: newEvent];
|
||||
|
||||
// [sogoObject changeParticipationStatus: newPartStat
|
||||
// withDelegate: nil];
|
||||
// // [[self context] tearDownRequest];
|
||||
// }
|
||||
// // }1005
|
||||
|
||||
// // else
|
||||
// // {
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self errorWithFormat: @"organizer was not set although a"
|
||||
@" recipient list was specified"];
|
||||
/* We must set the organizer preliminarily here because, unlike what
|
||||
the doc states, Outlook does not always pass the real organizer
|
||||
in the recipients list. */
|
||||
dict = [ownerUser primaryIdentity];
|
||||
person = [iCalPerson new];
|
||||
[person setCn: [dict objectForKey: @"fullName"]];
|
||||
orgEmail = [dict objectForKey: @"email"];
|
||||
[person setEmail: orgEmail];
|
||||
|
||||
activeUser = [[self context] activeUser];
|
||||
if (![activeUser isEqual: ownerUser])
|
||||
{
|
||||
dict = [activeUser primaryIdentity];
|
||||
sentBy = [NSString stringWithFormat: @"mailto:%@",
|
||||
[dict objectForKey: @"email"]];
|
||||
[person setSentBy: sentBy];
|
||||
}
|
||||
[newEvent setOrganizer: person];
|
||||
[person release];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[sogoObject saveComponent: newEvent];
|
||||
if (newParticipationStatus)
|
||||
[sogoObject changeParticipationStatus: newParticipationStatus
|
||||
withDelegate: nil];
|
||||
[self updateVersions];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user