From 73ad59a633b3d6c0cfd800b69e453ea987b87dd6 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 18:46:05 +0000 Subject: [PATCH 01/11] Monotone-Parent: 4adb09f9c02af62ea07b317c5c6a14100b8204e1 Monotone-Revision: cbe26077e3038a934e225a1903e28b89cf90c61d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T18:46:05 Monotone-Branch: ca.inverse.sogo --- OpenChange/NSObject+MAPIStore.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenChange/NSObject+MAPIStore.m b/OpenChange/NSObject+MAPIStore.m index 198e1969a..7fc75a74d 100644 --- a/OpenChange/NSObject+MAPIStore.m +++ b/OpenChange/NSObject+MAPIStore.m @@ -38,14 +38,15 @@ @implementation NSObject (MAPIStoreTallocHelpers) -static int MAPIStoreTallocWrapperDestroy (void *data) +static int +MAPIStoreTallocWrapperDestroy (void *data) { struct MAPIStoreTallocWrapper *wrapper; NSAutoreleasePool *pool; pool = [NSAutoreleasePool new]; wrapper = data; - NSLog (@"destroying wrapped object (wrapper: %p; object: %p)...\n", wrapper, wrapper->MAPIStoreSOGoObject); + // NSLog (@"destroying wrapped object (wrapper: %p; object: %p)...\n", wrapper, wrapper->MAPIStoreSOGoObject); [wrapper->MAPIStoreSOGoObject release]; [pool release]; @@ -57,10 +58,10 @@ static int MAPIStoreTallocWrapperDestroy (void *data) struct MAPIStoreTallocWrapper *wrapper; wrapper = talloc_zero (tallocCtx, struct MAPIStoreTallocWrapper); - wrapper->MAPIStoreSOGoObject = self; - [wrapper->MAPIStoreSOGoObject retain]; talloc_set_destructor ((void *) wrapper, MAPIStoreTallocWrapperDestroy); - NSLog (@"returning wrapper: %p; object: %p", wrapper, self); + wrapper->MAPIStoreSOGoObject = self; + [self retain]; + // NSLog (@"returning wrapper: %p; object: %p", wrapper, self); return wrapper; } From 4d60fa4dc31186fff961c0a2e9c0eb01ac4226c8 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 18:47:05 +0000 Subject: [PATCH 02/11] Monotone-Parent: cbe26077e3038a934e225a1903e28b89cf90c61d Monotone-Revision: cbef49b9665bb4860d576825ae411fd212ee0d08 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T18:47:05 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ OpenChange/NSDate+MAPIStore.h | 2 ++ OpenChange/NSDate+MAPIStore.m | 13 +++++++++++++ 3 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8f9d93bb1..6e915207a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-03-20 Wolfgang Sourdeau + * OpenChange/NSDate+MAPIStore.m (-isNever): new accessor for dates + occurring in 4500. + * OpenChange/MAPIStoreTypes.m (MAPIChangeKeyGUIDCompare): NSData arguments passed as "id" due to the pickiness of some versions of gcc. diff --git a/OpenChange/NSDate+MAPIStore.h b/OpenChange/NSDate+MAPIStore.h index a36fb5e16..3c7809f79 100644 --- a/OpenChange/NSDate+MAPIStore.h +++ b/OpenChange/NSDate+MAPIStore.h @@ -33,6 +33,8 @@ + (id) dateFromFileTime: (const struct FILETIME *) timeValue; - (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx; +- (BOOL) isNever; /* occurs on 4500-12-31 */ + @end #endif /* NSCALENDARDATE+MAPISTORE_H */ diff --git a/OpenChange/NSDate+MAPIStore.m b/OpenChange/NSDate+MAPIStore.m index d36ff6729..1c09fd0a2 100644 --- a/OpenChange/NSDate+MAPIStore.m +++ b/OpenChange/NSDate+MAPIStore.m @@ -114,4 +114,17 @@ _setupRefDate () return timeValue; } +- (BOOL) isNever /* occurs on 4500-12-31 */ +{ + NSCalendarDate *calDate; + + if ([self isKindOfClass: [NSCalendarDate class]]) + calDate = (NSCalendarDate *) self; + else + calDate = [NSCalendarDate dateWithTimeIntervalSince1970: + [self timeIntervalSince1970]]; + + return [calDate yearOfCommonEra] == 4500; +} + @end From 96c6581dfe71cecd530db5584b43775057fb098c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 18:50:09 +0000 Subject: [PATCH 03/11] Monotone-Parent: cbef49b9665bb4860d576825ae411fd212ee0d08 Monotone-Revision: c80a840b806ab1a13914a35d5bde6a6668427240 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T18:50:09 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ OpenChange/MAPIStoreAppointmentWrapper.h | 2 ++ OpenChange/MAPIStoreAppointmentWrapper.m | 8 ++++++++ OpenChange/MAPIStoreCalendarMessage.m | 7 +++++++ 4 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6e915207a..c3fa5ac93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2012-03-20 Wolfgang Sourdeau + * OpenChange/MAPIStoreCalendarMessage.m + (-getPidLidAppointmentSequence:inMemCtx:): new getter. + + * OpenChange/MAPIStoreAppointmentWrapper.m + (-getPidLidAppointmentSequence:inMemCtx:): new getter. + * OpenChange/NSDate+MAPIStore.m (-isNever): new accessor for dates occurring in 4500. diff --git a/OpenChange/MAPIStoreAppointmentWrapper.h b/OpenChange/MAPIStoreAppointmentWrapper.h index 7f68e82e0..efb5ac2a1 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.h +++ b/OpenChange/MAPIStoreAppointmentWrapper.h @@ -97,6 +97,8 @@ extern NSTimeZone *utcTZ; inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPidTagStartDate: (void **) data inMemCtx: (TALLOC_CTX *) memCtx; +- (int) getPidLidAppointmentSequence: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPidLidAppointmentStateFlags: (void **) data inMemCtx: (TALLOC_CTX *) memCtx; - (int) getPidLidResponseStatus: (void **) data diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 808acfe2b..76d5a0a30 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -657,6 +657,14 @@ static NSCharacterSet *hexCharacterSet = nil; return MAPISTORE_SUCCESS; } +- (int) getPidLidAppointmentSequence: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx +{ + *data = MAPILongValue (memCtx, [[event sequence] unsignedIntValue]); + + return MAPISTORE_SUCCESS; +} + - (int) getPidLidAppointmentStateFlags: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index 150838384..15ccb6437 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -166,6 +166,13 @@ return [[self appointmentWrapper] getPidTagStartDate: data inMemCtx: memCtx]; } +- (int) getPidLidAppointmentSequence: (void **) data + inMemCtx: (TALLOC_CTX *) memCtx +{ + return [[self appointmentWrapper] getPidLidAppointmentSequence: data + inMemCtx: memCtx]; +} + - (int) getPidLidAppointmentStateFlags: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { From 3a315446b092106d06cca4c04702da4d0f8a90f7 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 18:56:44 +0000 Subject: [PATCH 04/11] Monotone-Parent: c80a840b806ab1a13914a35d5bde6a6668427240 Monotone-Revision: 0917b3278898caa0cb56a12a960275816f5ab396 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T18:56:44 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 2 ++ OpenChange/MAPIStoreCalendarMessage.m | 28 ++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3fa5ac93..92f50891c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * OpenChange/MAPIStoreCalendarMessage.m (-getPidLidAppointmentSequence:inMemCtx:): new getter. + (-save): properly initialize CREATED, LAST-MODIFIED, DTSTAMP and + SEQUENCE from MAPI properties. * OpenChange/MAPIStoreAppointmentWrapper.m (-getPidLidAppointmentSequence:inMemCtx:): new getter. diff --git a/OpenChange/MAPIStoreCalendarMessage.m b/OpenChange/MAPIStoreCalendarMessage.m index 15ccb6437..004a30afc 100644 --- a/OpenChange/MAPIStoreCalendarMessage.m +++ b/OpenChange/MAPIStoreCalendarMessage.m @@ -725,14 +725,28 @@ 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]; } vCalendar = [iCalCalendar parseSingleFromSource: content]; newEvent = [[vCalendar events] objectAtIndex: 0]; - [newEvent setTimeStampAsDate: now]; - [newEvent setLastModified: now]; + + // 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 @@ -980,6 +994,11 @@ [newEvent setOrganizer: nil]; else { + // SEQUENCE = PidLidAppointmentSequence + value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentSequence)]; + if (value) + [newEvent setSequence: value]; + ownerUser = [[self userContext] sogoUser]; if (organizerIsSet) { @@ -1016,7 +1035,10 @@ } [person setParticipationStatus: newPartStat]; newParticipationStatus = [person partStatWithDefault]; - + + value = [properties objectForKey: MAPIPropertyKey (PidLidAttendeeCriticalChange)]; + if (value && ![value isNever]) + [newEvent setTimeStampAsDate: value]; // if (newPartStat // != iCalPersonPartStatUndefined // ) // { From ccc7e3652340154d867dd5ac6cad0c03d905dd68 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 20:28:54 +0000 Subject: [PATCH 05/11] Monotone-Parent: 4359e779a09c08a5fd03eda9fd8269ba9eeab6ff Monotone-Revision: 20fe3869b4c2b451d086944d0be00758c4b807f0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T20:28:54 --- SOPE/NGCards/iCalCalendar.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SOPE/NGCards/iCalCalendar.m b/SOPE/NGCards/iCalCalendar.m index 75b266641..0b6801cd5 100644 --- a/SOPE/NGCards/iCalCalendar.m +++ b/SOPE/NGCards/iCalCalendar.m @@ -101,7 +101,9 @@ - (void) setMethod: (NSString *) _value { - [[self uniqueChildWithTag: @"method"] setSingleValue: _value forKey: @""]; + [[self uniqueChildWithTag: @"method"] + setSingleValue: [_value uppercaseString] + forKey: @""]; } - (NSString *) method From 81fb0f41e7488020e3ee5e15a2e4bee52f047c33 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 20:30:51 +0000 Subject: [PATCH 06/11] Monotone-Parent: 73343e195be838a68cfbeb8edc978d8273b1e6da Monotone-Revision: 769d14eff848857403688bfa5bdf37f12459a7f1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T20:30:51 Monotone-Branch: ca.inverse.sogo --- Version | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Version b/Version index edc60fbcd..09503ebca 100644 --- a/Version +++ b/Version @@ -2,6 +2,6 @@ # This file is included by library makefiles to set the version information # of the executable. -MAJOR_VERSION=1 -MINOR_VERSION=3 -SUBMINOR_VERSION=14 +MAJOR_VERSION=2 +MINOR_VERSION=0 +SUBMINOR_VERSION=0 From 4d1900e52222a5515f37a9673315964960365343 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 20:31:36 +0000 Subject: [PATCH 07/11] Monotone-Parent: 769d14eff848857403688bfa5bdf37f12459a7f1 Monotone-Revision: edf1f1831a73df9eb13881bab5ebdbcfa7c40a23 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T20:31:36 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ OpenChange/MAPIStoreAppointmentWrapper.m | 1 + 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index c303dd634..0159c67c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ 2012-03-20 Wolfgang Sourdeau + * OpenChange/MAPIStoreAppointmentWrapper.m (-_setupITIPContext): + ensure method is uppercase. + * OpenChange/MAPIStoreCalendarMessage.m (-getPidLidAppointmentSequence:inMemCtx:): new getter. (-save): properly initialize CREATED, LAST-MODIFIED, DTSTAMP and diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 76d5a0a30..b3eb8df02 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -162,6 +162,7 @@ static NSCharacterSet *hexCharacterSet = nil; method = [[event parent] method]; if ([method length] > 0) { + method = [method uppercaseString]; [method retain]; if ([method isEqualToString: @"REPLY"]) { From 107728db4b7227985cbc712c140b2a1e870bb121 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Mar 2012 21:07:16 +0000 Subject: [PATCH 08/11] Monotone-Parent: edf1f1831a73df9eb13881bab5ebdbcfa7c40a23 Monotone-Revision: d93bbab8d949fa50be1d182af68b2eecf4c79105 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-20T21:07:16 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ SoObjects/SOGo/SOGoUserFolder.m | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0159c67c8..3a628972f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ 2012-03-20 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoUserFolder.m (-davLastName, -davFirstName): + quick and dirty implementation of those getters. + * OpenChange/MAPIStoreAppointmentWrapper.m (-_setupITIPContext): ensure method is uppercase. diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 862525153..c450dc0cf 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -635,6 +635,54 @@ getCNForUID: nameInContainer]; } +/* For firstname and lastname, we handle "Firstname Blabla Lastname" and + "Lastname, Firstname Blabla" */ +- (NSString *) davLastName +{ + NSArray *parts; + NSString *cn, *lastName; + NSRange comma; + + cn = [self davDisplayName]; + comma = [cn rangeOfString: @","]; + if (comma.location != NSNotFound) + lastName = [[cn substringToIndex: comma.location] + stringByTrimmingSpaces]; + else + { + parts = [cn componentsSeparatedByString: @" "]; + if ([parts count] > 0) + lastName = [parts lastObject]; + else + lastName = nil; + } + + return lastName; +} + +- (NSString *) davFirstName +{ + NSArray *parts; + NSString *subtext, *cn, *firstName; + NSRange comma; + + cn = [self davDisplayName]; + comma = [cn rangeOfString: @","]; + if (comma.location != NSNotFound) + subtext = [[cn substringFromIndex: comma.location] + stringByTrimmingSpaces]; + else + subtext = cn; + + parts = [subtext componentsSeparatedByString: @" "]; + if ([parts count] > 0) + firstName = [parts objectAtIndex: 0]; + else + firstName = nil; + + return firstName; +} + - (NSString *) davResourceId { return [NSString stringWithFormat: @"urn:uuid:%@", nameInContainer]; From f4311032a072eb83918004a3ab88d481fa9a3bcb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 21 Mar 2012 15:50:02 +0000 Subject: [PATCH 09/11] Monotone-Parent: 20fe3869b4c2b451d086944d0be00758c4b807f0 Monotone-Revision: 54cc41b15e02fc61bfa80e7db07aeb97e541fdfc Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-21T15:50:02 --- UI/Contacts/UIxContactsListActions.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/Contacts/UIxContactsListActions.m b/UI/Contacts/UIxContactsListActions.m index fd7db096e..f6941bc0f 100644 --- a/UI/Contacts/UIxContactsListActions.m +++ b/UI/Contacts/UIxContactsListActions.m @@ -167,7 +167,7 @@ onCriteria: @"name_or_address" sortBy: @"c_cn" ordering: NSOrderedAscending - inDomain: domain]; + inDomain: domain]; for (i = 0; i < [contacts count]; i++) { contact = [contacts objectAtIndex: i]; From 7a655ff8cefa0885ccc15bd365c4e6aa8c10c75b Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 21 Mar 2012 15:50:07 +0000 Subject: [PATCH 10/11] Monotone-Parent: 54cc41b15e02fc61bfa80e7db07aeb97e541fdfc Monotone-Revision: 3c8a49fe7ef93ec55aaeef9dd064be1de6052cfe Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-21T15:50:07 --- ChangeLog | 13 ++++++++ SoObjects/Contacts/SOGoContactGCSEntry.m | 5 +++ SoObjects/Contacts/SOGoContactLDIFEntry.m | 33 +++++++++++++++++++- SoObjects/Contacts/SOGoContactObject.h | 1 + SoObjects/Contacts/SOGoContactSourceFolder.m | 9 +++++- SoObjects/SOGo/SOGoUserManager.m | 15 +++++++-- UI/Contacts/UIxContactEditor.m | 2 +- 7 files changed, 73 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 329fedd75..78221e0d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2012-03-21 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUserManager.m (_compactAndCompleteContacts:): + if "mail" is an array, all values are added to "c_emails". + + * SoObjects/Contacts/SOGoContactSourceFolder.m + (_flattenedRecord:): if "mail" is an array, we only take the first + value of it. + + * SoObjects/Contacts/SOGoContactLDIFEntry.m (-simplifiedRecord): + new record guaranteeing that all array values have been stripped + and converted to strings. + 2012-03-20 Francis Lachapelle * SoObjects/Mailer/SOGoMailObject+Draft.m diff --git a/SoObjects/Contacts/SOGoContactGCSEntry.m b/SoObjects/Contacts/SOGoContactGCSEntry.m index 09c18ebbd..fd33f7cfc 100644 --- a/SoObjects/Contacts/SOGoContactGCSEntry.m +++ b/SoObjects/Contacts/SOGoContactGCSEntry.m @@ -76,6 +76,11 @@ return [[self vCard] asLDIFRecord]; } +- (NSDictionary *) simplifiedLDIFRecord +{ + return [self ldifRecord]; +} + - (BOOL) hasPhoto { return ([[self vCard] firstChildWithTag: @"photo"] != nil); diff --git a/SoObjects/Contacts/SOGoContactLDIFEntry.m b/SoObjects/Contacts/SOGoContactLDIFEntry.m index f4b09e800..6801875fb 100644 --- a/SoObjects/Contacts/SOGoContactLDIFEntry.m +++ b/SoObjects/Contacts/SOGoContactLDIFEntry.m @@ -95,7 +95,7 @@ [vcard setProdID: [NSString stringWithFormat: @"-//Inverse inc./SOGo %@//EN", SOGoVersion]]; - [vcard updateFromLDIFRecord: [self ldifRecord]]; + [vcard updateFromLDIFRecord: [self simplifiedLDIFRecord]]; return vcard; } @@ -115,6 +115,37 @@ return ldifEntry; } +- (NSDictionary *) simplifiedLDIFRecord +{ + NSMutableDictionary *newRecord; + NSArray *keys; + NSUInteger count, max; + NSString *key; + id value; + + newRecord = [[self ldifRecord] mutableCopy]; + [newRecord autorelease]; + + keys = [newRecord allKeys]; + max = [keys count]; + for (count = 0; count < max; count++) + { + key = [keys objectAtIndex: count]; + value = [newRecord objectForKey: key]; + if ([value isKindOfClass: [NSArray class]] + && ![key isEqualToString: @"objectclass"]) + { + if ([value count] > 0) + [newRecord setObject: [value objectAtIndex: 0] + forKey: key]; + else + [newRecord removeObjectForKey: key]; + } + } + + return newRecord; +} + - (BOOL) hasPhoto { return NO; diff --git a/SoObjects/Contacts/SOGoContactObject.h b/SoObjects/Contacts/SOGoContactObject.h index 6b718eefa..e49219a91 100644 --- a/SoObjects/Contacts/SOGoContactObject.h +++ b/SoObjects/Contacts/SOGoContactObject.h @@ -33,6 +33,7 @@ /* web editing */ - (void) setLDIFRecord: (NSDictionary *) newLDIFRecord; - (NSDictionary *) ldifRecord; +- (NSDictionary *) simplifiedLDIFRecord; - (NSException *) save; - (NSException *) delete; diff --git a/SoObjects/Contacts/SOGoContactSourceFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m index 780bcd742..b4a5b2318 100644 --- a/SoObjects/Contacts/SOGoContactSourceFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -213,7 +213,7 @@ - (NSDictionary *) _flattenedRecord: (NSDictionary *) oldRecord { NSMutableDictionary *newRecord; - NSString *data; + id data; NSObject *recordSource; newRecord = [NSMutableDictionary dictionaryWithCapacity: 8]; @@ -232,6 +232,13 @@ data = [oldRecord objectForKey: @"mail"]; if (!data) data = @""; + else if ([data isKindOfClass: [NSArray class]]) + { + if ([data count] > 0) + data = [data objectAtIndex: 0]; + else + data = @""; + } [newRecord setObject: data forKey: @"c_mail"]; data = [oldRecord objectForKey: @"nsaimid"]; diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index e84ca329a..6540de462 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -816,11 +816,12 @@ { NSMutableDictionary *compactContacts, *returnContact; NSDictionary *userEntry; - NSArray *newContacts; + NSArray *newContacts, *allEmails; NSMutableArray *emails; NSString *uid, *email, *info; NSNumber *isGroup; id source; + NSUInteger count, max; compactContacts = [NSMutableDictionary dictionary]; while ((userEntry = [contacts nextObject])) @@ -851,7 +852,17 @@ [returnContact setObject: emails forKey: @"emails"]; } email = [userEntry objectForKey: @"mail"]; - if (email && ![emails containsObject: email]) + if ([email isKindOfClass: [NSArray class]]) + { + allEmails = (NSArray *) email; + max = [allEmails count]; + for (count = 0; count < max; count++) + { + email = [allEmails objectAtIndex: count]; + [emails addObjectUniquely: email]; + } + } + else if (email && ![emails containsObject: email]) [emails addObject: email]; email = [userEntry objectForKey: @"mozillasecondemail"]; if (email && ![emails containsObject: email]) diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index 73a88d448..b73125d1a 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -88,7 +88,7 @@ static Class SOGoContactGCSEntryK = Nil; if (!ldifRecord) { - clientLDIFRecord = [[self clientObject] ldifRecord]; + clientLDIFRecord = [[self clientObject] simplifiedLDIFRecord]; ldifRecord = [clientLDIFRecord mutableCopy]; queryValue = [self queryParameterForKey: @"contactEmail"]; if ([queryValue length] > 0) From 0ec64bc634d2b85d67f1f6d1700f228a91aef777 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 22 Mar 2012 15:23:59 +0000 Subject: [PATCH 11/11] Monotone-Parent: 8d867d6c59e7ebea428c107ce0681159571e7c90 Monotone-Revision: 72cfb3dcfa19c247349b29d61b4878d418d4c13e Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-22T15:23:59 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ OpenChange/MAPIStoreTasksMessage.m | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c3b79c5d4..bb98da8be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-22 Wolfgang Sourdeau + + * OpenChange/MAPIStoreTasksMessage.m (-save): + PidLidPercentComplete is a double, that we need to convert in + order to obtain the proper value. + 2012-03-21 Wolfgang Sourdeau * SoObjects/SOGo/SOGoUserManager.m (_compactAndCompleteContacts:): diff --git a/OpenChange/MAPIStoreTasksMessage.m b/OpenChange/MAPIStoreTasksMessage.m index 658817650..206907973 100644 --- a/OpenChange/MAPIStoreTasksMessage.m +++ b/OpenChange/MAPIStoreTasksMessage.m @@ -331,6 +331,7 @@ NSString *status, *priority; NSCalendarDate *now; NSInteger tzOffset; + double doubleValue; vToDo = [sogoObject component: YES secure: NO]; vCalendar = [vToDo parent]; @@ -452,7 +453,11 @@ // is always set to 0, no matter what value is set in Outlook value = [properties objectForKey: MAPIPropertyKey (PidLidPercentComplete)]; if (value) - [vToDo setPercentComplete: [value stringValue]]; + { + doubleValue = [value doubleValue]; + [vToDo setPercentComplete: + [NSString stringWithFormat: @"%d", (int) (doubleValue * 100)]]; + } now = [NSCalendarDate date]; if ([sogoObject isNew])