Monotone-Parent: 35e905507b00aa93112b244da8c4f4c32c7942c7

Monotone-Revision: c4cd64ca35c43c187a23cc30e1bad4db1a5e9d1d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-08-06T19:20:07
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2012-08-06 19:20:07 +00:00
parent df6f1e3023
commit 28816877aa
5 changed files with 200 additions and 41 deletions

View File

@@ -122,6 +122,7 @@
NSString *newKey;
MAPIStoreCalendarAttachment *attachment;
NSUInteger aid;
iCalEvent *event;
events = [calendar events];
max = [events count];
@@ -133,8 +134,10 @@
right AID is 0 from the start */
aid = count - 1;
[attachment setAID: aid];
[attachment setEvent: [events objectAtIndex: count]];
newKey = [NSString stringWithFormat: @"%ul", aid];
event = [events objectAtIndex: count];
[attachment setEvent: event];
newKey = [[event uniqueChildWithTag: @"recurrence-id"]
flattenedValuesForKey: @""];
[attachmentParts setObject: attachment forKey: newKey];
}
}
@@ -201,14 +204,6 @@
return MAPISTORE_SUCCESS;
}
- (int) getPidLidAppointmentMessageClass: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
*data = talloc_strdup (memCtx, "IPM.Appointment");
return MAPISTORE_SUCCESS;
}
- (int) getPidLidSideEffects: (void **) data // TODO
inMemCtx: (TALLOC_CTX *) memCtx
{
@@ -422,41 +417,28 @@
return rc;
}
- (void) _updateAttachedEvent: (MAPIStoreCalendarAttachment *) attachment
withUID: (NSString *) uid
{
iCalEvent *newEvent;
SOGoUser *activeUser;
newEvent = [iCalEvent groupWithTag: @"vevent"];
[calendar addToEvents: newEvent];
activeUser = [[self context] activeUser];
[newEvent setUid: uid];
[newEvent updateFromMAPIProperties: [attachment properties]
inUserContext: [self userContext]
withActiveUser: activeUser];
}
- (void) _updateAttachedEvents
{
NSMutableArray *otherEvents;
NSArray *allAttachments;
NSUInteger count, max;
NSString *uid;
/* cleanup all recurring events */
otherEvents = [[calendar events] mutableCopy];
[otherEvents removeObject: masterEvent];
[calendar removeChildren: otherEvents];
[otherEvents release];
NSString *uid, *summary;
iCalEvent *event;
MAPIStoreCalendarAttachment *attachment;
/* ensure that all exception events have the same UID as the master */
uid = [masterEvent uid];
summary = [masterEvent summary];
allAttachments = [attachmentParts allValues];
max = [allAttachments count];
for (count = 0; count < max; count++)
[self _updateAttachedEvent: [allAttachments objectAtIndex: count]
withUID: uid];
{
attachment = [allAttachments objectAtIndex: count];
event = [attachment event];
if ([[event summary] length] == 0)
[event setSummary: summary];
[event setUid: uid];
}
}
- (void) save
@@ -513,12 +495,17 @@
MAPIStoreCalendarAttachment *newAttachment;
uint32_t newAid;
NSString *newKey;
iCalEvent *newEvent;
newAid = [[self attachmentKeys] count];
newAttachment = [MAPIStoreCalendarAttachment
mapiStoreObjectInContainer: self];
[newAttachment setAID: newAid];
newEvent = [iCalEvent groupWithTag: @"vevent"];
[newAttachment setEvent: newEvent];
[calendar addToEvents: newEvent];
newKey = [NSString stringWithFormat: @"%ul", newAid];
[attachmentParts setObject: newAttachment
forKey: newKey];