From 16be267346354f4540e6142753370f11caea68b5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 28 Jul 2008 20:29:24 +0000 Subject: [PATCH] Monotone-Parent: 783e348847b1713263dc1788ecc748a3b7c3bcfa Monotone-Revision: 56d4fc5e8a975c626a7d96d0b6909e1e238818ea Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-07-28T20:29:24 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 ++++++++++ SoObjects/SOGo/LDAPUserManager.h | 1 + SoObjects/SOGo/LDAPUserManager.m | 23 ++++++++++++++++++++--- SoObjects/SOGo/SOGoUserFolder.m | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51df83790..b14a564a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-07-28 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder + -foldersOfType:typematchingUID:uid]): make searches only in user + repositories and not in addressbooks. + + * SoObjects/SOGo/LDAPUserManager.m ([LDAPUserManager + -fetchUsersMatching:filter]): new method allowing to make searches + only in user repositories. + 2008-07-25 Wolfgang Sourdeau * UI/Scheduler/UIxCalMainView.m ([UIxCalMainView -dayStartHour]): diff --git a/SoObjects/SOGo/LDAPUserManager.h b/SoObjects/SOGo/LDAPUserManager.h index 3c067940c..a400af521 100644 --- a/SoObjects/SOGo/LDAPUserManager.h +++ b/SoObjects/SOGo/LDAPUserManager.h @@ -54,6 +54,7 @@ - (NSString *) displayNameForSourceWithID: (NSString *) sourceID; - (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid; - (NSArray *) fetchContactsMatching: (NSString *) match; +- (NSArray *) fetchUsersMatching: (NSString *) filter; - (NSString *) getCNForUID: (NSString *) uid; - (NSString *) getEmailForUID: (NSString *) uid; diff --git a/SoObjects/SOGo/LDAPUserManager.m b/SoObjects/SOGo/LDAPUserManager.m index f0668f386..fc49fc71b 100644 --- a/SoObjects/SOGo/LDAPUserManager.m +++ b/SoObjects/SOGo/LDAPUserManager.m @@ -164,14 +164,12 @@ static BOOL forceImapLoginWithEmail = NO; sourceIDs = [NSMutableArray array]; allIDs = [[sources allKeys] objectEnumerator]; - currentID = [allIDs nextObject]; - while (currentID) + while ((currentID = [allIDs nextObject])) { canAuthenticate = [[sourcesMetadata objectForKey: currentID] objectForKey: sourceType]; if ([canAuthenticate boolValue]) [sourceIDs addObject: currentID]; - currentID = [allIDs nextObject]; } return sourceIDs; @@ -516,6 +514,25 @@ static BOOL forceImapLoginWithEmail = NO; return [self _compactAndCompleteContacts: [contacts objectEnumerator]]; } +- (NSArray *) fetchUsersMatching: (NSString *) filter +{ + NSMutableArray *contacts; + NSEnumerator *ldapSources; + NSString *sourceID; + LDAPSource *currentSource; + + contacts = [NSMutableArray array]; + ldapSources = [[self authenticationSourceIDs] objectEnumerator]; + while ((sourceID = [ldapSources nextObject])) + { + currentSource = [sources objectForKey: sourceID]; + [contacts addObjectsFromArray: + [currentSource fetchContactsMatching: filter]]; + } + + return [self _compactAndCompleteContacts: [contacts objectEnumerator]]; +} + - (void) cleanupSources { NSEnumerator *userIDs; diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 6c1360ca7..252c6ac65 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -194,7 +194,7 @@ results = [NSMutableDictionary dictionary]; contacts - = [[LDAPUserManager sharedUserManager] fetchContactsMatching: uid]; + = [[LDAPUserManager sharedUserManager] fetchUsersMatching: uid]; enumerator = [contacts objectEnumerator]; while ((contact = [enumerator nextObject])) {