From 3d678542e69e7d04b0b7211bb99f63f536ff3b27 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 3 Oct 2011 23:13:00 +0000 Subject: [PATCH] Monotone-Parent: 0d19e885a7f8be171d1439b137c806b999725da7 Monotone-Revision: b7149a366c94f57bf67d221e26b33ecf51930a27 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-10-03T23:13:00 Monotone-Branch: ca.inverse.sogo --- OpenChange/MAPIStoreCalendarMessage.m | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index 6f399a4ed..52a4a751e 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -478,24 +478,23 @@ existingCName = [[container sogoObject] resourceNameForEventUID: uid]; if (existingCName) { - /* Steps: - unregister self'url mapping - unregister old object's url mapping to discard further delete operation - set new object nameInContainer - register new url mapping */ - mapping = [[self context] mapping]; + /* dissociate the object url from the old object's id */ existingURL = [NSString stringWithFormat: @"%@%@", [container url], existingCName]; objectId = [mapping idFromURL: existingURL]; [mapping unregisterURLWithID: objectId]; + /* dissociate the object url associated with this object, as we want to + discard it */ objectId = [self objectId]; [mapping unregisterURLWithID: objectId]; - + + /* associate the object url with this object id */ [mapping registerURL: existingURL withID: objectId]; + /* reinstantiate the old sogo object and attach it to self */ woContext = [[self context] woContext]; existingObject = [[container sogoObject] lookupName: existingCName inContext: woContext @@ -521,12 +520,11 @@ if (isNew) { - /* big response hack: - - if isNew: - - deduce UID from GlobalObjectId - - if UID already exist in db: - - invoke setNameInContainer on sogoObject with proper cname */ - + /* 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. */ [self _fixupEventWithExistingUID]; }