Monotone-Parent: e29f563ab0cd9f47da56070fa528af4b9c253e7a

Monotone-Revision: 7c72afa296dc94afa8d710aab09110f090d96946

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-05-10T19:01:09
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-05-10 19:01:09 +00:00
parent 8ebf0d88e5
commit 7f609d3219
2 changed files with 32 additions and 55 deletions

View File

@ -1,5 +1,11 @@
2007-05-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView
-contactSearchAction]): simplified method to use the facilities
provided by the LDAPUserManager. No longer takes care of the
"ldap-only" url parameter since all requests are handled by the
usermanager now.
* SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
-primaryFetchProfile]): check that the value returned is not null
before interpreting it.

View File

@ -116,30 +116,6 @@
}
}
- (NSDictionary *) _searchResults: (NSString *) contact
ldapFoldersOnly: (BOOL) ldapOnly
{
NSMutableDictionary *results;
SOGoContactFolders *topFolder;
NSEnumerator *sogoContactFolders;
id <SOGoContactFolder> currentFolder;
results = [NSMutableDictionary dictionary];
topFolder = [self clientObject];
sogoContactFolders = [[topFolder contactFolders] objectEnumerator];
currentFolder = [sogoContactFolders nextObject];
while (currentFolder)
{
if (!ldapOnly || [currentFolder isKindOfClass: [SOGoContactLDAPFolder class]])
[self _fillResults: results inFolder: currentFolder
withSearchOn: contact];
currentFolder = [sogoContactFolders nextObject];
}
[topFolder release];
return results;
}
- (NSString *) _emailForResult: (NSDictionary *) result
{
NSMutableString *email;
@ -158,33 +134,30 @@
return email;
}
- (WOResponse *) _responseForResults: (NSDictionary *) results
- (WOResponse *) _responseForResults: (NSArray *) results
{
WOResponse *response;
NSEnumerator *uids;
NSString *responseString, *uid, *cn, *mail;
NSDictionary *result;
NSEnumerator *contacts;
NSString *responseString;
NSDictionary *contact;
response = [context response];
if ([results count])
if ([results count] > 0)
{
uids = [[results allKeys] objectEnumerator];
uid = [uids nextObject];
while (uid)
contacts = [results objectEnumerator];
contact = [contacts nextObject];
while (contact)
{
result = [results objectForKey: uid];
cn = [result objectForKey: @"displayName"];
if (![cn length])
cn = [result objectForKey: @"cn"];
mail = [result objectForKey: @"mail"];
responseString = [NSString stringWithFormat: @"%@:%@:%@",
uid, cn, mail];
[contact objectForKey: @"c_uid"],
[contact objectForKey: @"cn"],
[contact objectForKey: @"c_email"]];
[response setStatus: 200];
[response setHeader: @"text/plain; charset=iso-8859-1"
forKey: @"Content-Type"];
[response appendContentString: responseString];
uid = [uids nextObject];
contact = [contacts nextObject];
}
}
else
@ -197,14 +170,15 @@
{
NSString *contact;
id <WOActionResults> result;
BOOL ldapFoldersOnly;
LDAPUserManager *um;
contact = [self queryParameterForKey: @"search"];
ldapFoldersOnly = [[self queryParameterForKey: @"ldap-only"] boolValue];
if ([contact length] > 0)
result
= [self _responseForResults: [self _searchResults: contact
ldapFoldersOnly: ldapFoldersOnly]];
{
um = [LDAPUserManager sharedUserManager];
result
= [self _responseForResults: [um fetchContactsMatching: contact]];
}
else
result = [NSException exceptionWithHTTPStatus: 400
reason: @"missing 'search' parameter"];
@ -328,16 +302,13 @@
while (contact)
{
uid = [contact objectForKey: @"c_uid"];
if ([uid length] > 0)
{
folders = [self _foldersForUID: uid ofType: folderType];
foldersString
= [self _foldersStringForFolders: [folders objectEnumerator]];
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
[contact objectForKey: @"cn"],
[contact objectForKey: @"c_email"],
foldersString];
}
folders = [self _foldersForUID: uid ofType: folderType];
foldersString
= [self _foldersStringForFolders: [folders objectEnumerator]];
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
[contact objectForKey: @"cn"],
[contact objectForKey: @"c_email"],
foldersString];
contact = [contacts nextObject];
}
[response appendContentString: responseString];