mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-21 11:25:24 +00:00
Monotone-Parent: 75ec663b4b26859e635b90a350146642970dc3c2
Monotone-Revision: a5a4c03e7f73726c0698328f9ab3e90d3a4a2432 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-04-19T16:35:35 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -56,39 +56,40 @@
|
||||
WOResponse *response;
|
||||
NSArray *contactsId;
|
||||
NSEnumerator *uids;
|
||||
NSString *uid, *filename;
|
||||
NSString *uid, *filename, *disposition;
|
||||
id currentChild;
|
||||
SOGoContactGCSFolder *sourceFolder;
|
||||
NSMutableString *content;
|
||||
|
||||
content = [NSMutableString string];
|
||||
request = [context request];
|
||||
sourceFolder = [self clientObject];
|
||||
contactsId = [request formValuesForKey: @"uid"];
|
||||
if (contactsId)
|
||||
if (!contactsId)
|
||||
contactsId = [sourceFolder toOneRelationshipKeys];
|
||||
|
||||
uids = [contactsId objectEnumerator];
|
||||
while ((uid = [uids nextObject]))
|
||||
{
|
||||
sourceFolder = [self clientObject];
|
||||
uids = [contactsId objectEnumerator];
|
||||
while ((uid = [uids nextObject]))
|
||||
{
|
||||
currentChild = [sourceFolder lookupName: uid
|
||||
inContext: [self context]
|
||||
acquire: NO];
|
||||
if ([currentChild respondsToSelector: @selector (vCard)])
|
||||
[content appendFormat: [[currentChild vCard] ldifString]];
|
||||
else if ([currentChild respondsToSelector: @selector (vList)])
|
||||
[content appendFormat: [[currentChild vList] ldifString]];
|
||||
}
|
||||
currentChild = [sourceFolder lookupName: uid
|
||||
inContext: [self context]
|
||||
acquire: NO];
|
||||
if ([currentChild respondsToSelector: @selector (vCard)])
|
||||
[content appendFormat: [[currentChild vCard] ldifString]];
|
||||
else if ([currentChild respondsToSelector: @selector (vList)])
|
||||
[content appendFormat: [[currentChild vList] ldifString]];
|
||||
}
|
||||
|
||||
filename = [NSString stringWithFormat: @"attachment;filename=\"%@.ldif\"",
|
||||
[sourceFolder displayName]];
|
||||
response = [context response];
|
||||
[response setHeader: @"application/octet-stream; charset=utf-8"
|
||||
forKey: @"content-type"];
|
||||
[response setHeader: filename
|
||||
forKey: @"Content-Disposition"];
|
||||
filename = [NSString stringWithFormat: @"%@.ldif",
|
||||
[sourceFolder displayName]];
|
||||
disposition = [NSString stringWithFormat: @"attachment; filename=\"%@\"",
|
||||
[filename asQPSubjectString: @"utf-8"]];
|
||||
[response setHeader: disposition forKey: @"Content-Disposition"];
|
||||
[response setContent: [content dataUsingEncoding: NSUTF8StringEncoding]];
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user