mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 11:55:24 +00:00
Monotone-Parent: 07c2681e0251d505e6978723e5907b33527cf279
Monotone-Revision: 356dad69ed3731f29474c5f2e6359c928c942702 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-03-09T20:28:24 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -276,47 +276,43 @@
|
||||
|
||||
- (WOResponse *) _usersResponseForResults: (NSArray *) users
|
||||
{
|
||||
WOResponse *response;
|
||||
NSString *uid;
|
||||
NSMutableString *responseString;
|
||||
NSDictionary *contact;
|
||||
NSString *contactInfo, *login;
|
||||
NSMutableArray *jsonResponse, *jsonLine;
|
||||
NSArray *allUsers;
|
||||
int i;
|
||||
int count, max;
|
||||
|
||||
login = [[context activeUser] login];
|
||||
response = [context response];
|
||||
[response setStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
forKey: @"Content-Type"];
|
||||
|
||||
responseString = [NSMutableString string];
|
||||
|
||||
// We sort our array - this is pretty useful for the Web
|
||||
// interface of SOGo.
|
||||
allUsers = [users
|
||||
sortedArrayUsingSelector: @selector (caseInsensitiveDisplayNameCompare:)];
|
||||
|
||||
for (i = 0; i < [allUsers count]; i++)
|
||||
max = [allUsers count];
|
||||
jsonResponse = [NSMutableArray arrayWithCapacity: max];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
contact = [allUsers objectAtIndex: i];
|
||||
contact = [allUsers objectAtIndex: count];
|
||||
uid = [contact objectForKey: @"c_uid"];
|
||||
|
||||
// We do NOT return the current authenticated user.
|
||||
if (![uid isEqualToString: login])
|
||||
{
|
||||
jsonLine = [NSMutableArray arrayWithCapacity: 4];
|
||||
[jsonLine addObject: uid];
|
||||
[jsonLine addObject: [contact objectForKey: @"cn"]];
|
||||
[jsonLine addObject: [contact objectForKey: @"c_email"]];
|
||||
contactInfo = [contact objectForKey: @"c_info"];
|
||||
if (!contactInfo)
|
||||
contactInfo = @"";
|
||||
[responseString appendFormat: @"%@:%@:%@:%@\n", uid,
|
||||
[contact objectForKey: @"cn"],
|
||||
[contact objectForKey: @"c_email"],
|
||||
contactInfo];
|
||||
if (contactInfo)
|
||||
[jsonLine addObject: contactInfo];
|
||||
[jsonResponse addObject: jsonLine];
|
||||
}
|
||||
}
|
||||
[response appendContentString: responseString];
|
||||
|
||||
return response;
|
||||
return [self responseWithStatus: 200
|
||||
andJSONRepresentation: jsonResponse];
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) usersSearchAction
|
||||
|
||||
Reference in New Issue
Block a user