diff --git a/ChangeLog b/ChangeLog index 5ad844fe5..5b4987aca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-10-14 Ludovic Marcotte + + * SoObjects/SOGo/SOGoGCSFolder.m (setRoles:forUser:..) + We now even cache "None" roles. + * SoObjects/Mailer/SOGoMailObject.m (fetchCoreInfos) + We now handle correctly untagged responses. + 2011-10-13 Francis Lachapelle * Tools/SOGoToolUserPreferences.m (-run): added possibility to diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 8faf74c47..15ca436e5 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -217,6 +217,7 @@ static BOOL debugSoParts = NO; - (id) fetchCoreInfos { id msgs; + int i; if (!coreInfos) { @@ -224,8 +225,21 @@ static BOOL debugSoParts = NO; if (heavyDebug) [self logWithFormat: @"M: %@", msgs]; msgs = [msgs valueForKey: @"fetch"]; + + // We MUST honor untagged IMAP responses here otherwise we could + // return really borken and nasty results. if ([msgs count] > 0) - coreInfos = [msgs objectAtIndex: 0]; + { + for (i = 0; i < [msgs count]; i++) + { + coreInfos = [msgs objectAtIndex: i]; + + if ([[coreInfos objectForKey: @"uid"] intValue] == [[self nameInContainer] intValue]) + break; + + coreInfos = nil; + } + } [coreInfos retain]; } diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index e2025710f..96bb3890f 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -1637,11 +1637,13 @@ static NSArray *childRecordFields = nil; [newRoles removeObject: SOGoRole_AuthorizedSubscriber]; [newRoles removeObject: SOGoRole_None]; objectPath = [objectPathArray componentsJoinedByString: @"/"]; - [self _cacheRoles: newRoles forUser: uid - forObjectAtPath: objectPath]; + if (![newRoles count]) [newRoles addObject: SOGoRole_None]; + [self _cacheRoles: newRoles forUser: uid + forObjectAtPath: objectPath]; + [self _commitRoles: newRoles forUID: aUID forObject: objectPath]; }