JSON-based operations on contacts

This commit is contained in:
Francis Lachapelle
2014-06-19 15:51:57 -04:00
parent a4ac4db1e0
commit 065acc9ff1
13 changed files with 815 additions and 102 deletions
+33
View File
@@ -36,6 +36,7 @@
#import <Contacts/SOGoContactObject.h>
#import <Contacts/SOGoContactFolder.h>
#import <Contacts/SOGoContactFolders.h>
#import <Contacts/SOGoContactGCSFolder.h>
#import <Contacts/NSDictionary+LDIF.h>
#import <SoObjects/Contacts/NGVCard+SOGo.h>
@@ -46,6 +47,8 @@
#import <SoObjects/Contacts/SOGoContactGCSFolder.h>
#import <GDLContentStore/GCSFolder.h>
#import <SOGo/NSString+Utilities.h>
#import "UIxContactFolderActions.h"
@implementation UIxContactFolderActions
@@ -276,6 +279,7 @@
uid = [folder globallyUniqueObjectId];
[card setUid: uid];
// TODO: shall we add .vcf as in [SOGoContactGCSEntry copyToFolder:]
contact = [SOGoContactGCSEntry objectWithName: uid
inContainer: folder];
[contact setIsNew: YES];
@@ -288,4 +292,33 @@
return rc;
}
- (id <WOActionResults>) saveAction
{
SOGoContactGCSFolder *folder;
WORequest *request;
WOResponse *response;
NSDictionary *params, *message;
NSString *folderName;
request = [context request];
NSLog(@"%@", [request contentAsString]);
params = [[request contentAsString] objectFromJSONString];
folderName = [params objectForKey: @"name"];
if ([folderName length] > 0)
{
folder = [self clientObject];
[folder renameTo: folderName];
response = [self responseWith204];
}
else
{
message = [NSDictionary dictionaryWithObject: @"Missing name parameter" forKey: @"error"];
response = [self responseWithStatus: 500
andString: [message jsonRepresentation]];
}
return response;
}
@end /* UIxContactFolderActions */