Monotone-Parent: e29f563ab0cd9f47da56070fa528af4b9c253e7a
Monotone-Revision: 7c72afa296dc94afa8d710aab09110f090d96946 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-10T19:01:09 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
8ebf0d88e5
commit
7f609d3219
|
@ -1,5 +1,11 @@
|
||||||
2007-05-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
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
|
* SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
|
||||||
-primaryFetchProfile]): check that the value returned is not null
|
-primaryFetchProfile]): check that the value returned is not null
|
||||||
before interpreting it.
|
before interpreting it.
|
||||||
|
|
|
@ -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
|
- (NSString *) _emailForResult: (NSDictionary *) result
|
||||||
{
|
{
|
||||||
NSMutableString *email;
|
NSMutableString *email;
|
||||||
|
@ -158,33 +134,30 @@
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (WOResponse *) _responseForResults: (NSDictionary *) results
|
- (WOResponse *) _responseForResults: (NSArray *) results
|
||||||
{
|
{
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
NSEnumerator *uids;
|
NSEnumerator *contacts;
|
||||||
NSString *responseString, *uid, *cn, *mail;
|
NSString *responseString;
|
||||||
NSDictionary *result;
|
NSDictionary *contact;
|
||||||
|
|
||||||
response = [context response];
|
response = [context response];
|
||||||
|
|
||||||
if ([results count])
|
if ([results count] > 0)
|
||||||
{
|
{
|
||||||
uids = [[results allKeys] objectEnumerator];
|
contacts = [results objectEnumerator];
|
||||||
uid = [uids nextObject];
|
contact = [contacts nextObject];
|
||||||
while (uid)
|
while (contact)
|
||||||
{
|
{
|
||||||
result = [results objectForKey: uid];
|
|
||||||
cn = [result objectForKey: @"displayName"];
|
|
||||||
if (![cn length])
|
|
||||||
cn = [result objectForKey: @"cn"];
|
|
||||||
mail = [result objectForKey: @"mail"];
|
|
||||||
responseString = [NSString stringWithFormat: @"%@:%@:%@",
|
responseString = [NSString stringWithFormat: @"%@:%@:%@",
|
||||||
uid, cn, mail];
|
[contact objectForKey: @"c_uid"],
|
||||||
|
[contact objectForKey: @"cn"],
|
||||||
|
[contact objectForKey: @"c_email"]];
|
||||||
[response setStatus: 200];
|
[response setStatus: 200];
|
||||||
[response setHeader: @"text/plain; charset=iso-8859-1"
|
[response setHeader: @"text/plain; charset=iso-8859-1"
|
||||||
forKey: @"Content-Type"];
|
forKey: @"Content-Type"];
|
||||||
[response appendContentString: responseString];
|
[response appendContentString: responseString];
|
||||||
uid = [uids nextObject];
|
contact = [contacts nextObject];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -197,14 +170,15 @@
|
||||||
{
|
{
|
||||||
NSString *contact;
|
NSString *contact;
|
||||||
id <WOActionResults> result;
|
id <WOActionResults> result;
|
||||||
BOOL ldapFoldersOnly;
|
LDAPUserManager *um;
|
||||||
|
|
||||||
contact = [self queryParameterForKey: @"search"];
|
contact = [self queryParameterForKey: @"search"];
|
||||||
ldapFoldersOnly = [[self queryParameterForKey: @"ldap-only"] boolValue];
|
|
||||||
if ([contact length] > 0)
|
if ([contact length] > 0)
|
||||||
result
|
{
|
||||||
= [self _responseForResults: [self _searchResults: contact
|
um = [LDAPUserManager sharedUserManager];
|
||||||
ldapFoldersOnly: ldapFoldersOnly]];
|
result
|
||||||
|
= [self _responseForResults: [um fetchContactsMatching: contact]];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
result = [NSException exceptionWithHTTPStatus: 400
|
result = [NSException exceptionWithHTTPStatus: 400
|
||||||
reason: @"missing 'search' parameter"];
|
reason: @"missing 'search' parameter"];
|
||||||
|
@ -328,16 +302,13 @@
|
||||||
while (contact)
|
while (contact)
|
||||||
{
|
{
|
||||||
uid = [contact objectForKey: @"c_uid"];
|
uid = [contact objectForKey: @"c_uid"];
|
||||||
if ([uid length] > 0)
|
folders = [self _foldersForUID: uid ofType: folderType];
|
||||||
{
|
foldersString
|
||||||
folders = [self _foldersForUID: uid ofType: folderType];
|
= [self _foldersStringForFolders: [folders objectEnumerator]];
|
||||||
foldersString
|
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
|
||||||
= [self _foldersStringForFolders: [folders objectEnumerator]];
|
[contact objectForKey: @"cn"],
|
||||||
[responseString appendFormat: @"%@:%@:%@%@\n", uid,
|
[contact objectForKey: @"c_email"],
|
||||||
[contact objectForKey: @"cn"],
|
foldersString];
|
||||||
[contact objectForKey: @"c_email"],
|
|
||||||
foldersString];
|
|
||||||
}
|
|
||||||
contact = [contacts nextObject];
|
contact = [contacts nextObject];
|
||||||
}
|
}
|
||||||
[response appendContentString: responseString];
|
[response appendContentString: responseString];
|
||||||
|
|
Loading…
Reference in a new issue