Skip to content

Commit

Permalink
Changes for Drupal7
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebrowning committed Nov 4, 2010
1 parent d7859d4 commit fc5989d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
21 changes: 11 additions & 10 deletions DIOSConnect.m
Expand Up @@ -42,10 +42,6 @@
#import "NSData+Base64.h"
#import "DIOSConfig.h"
@implementation DIOSConnect
<<<<<<< HEAD
=======

>>>>>>> 6.x-3.x
@synthesize connResult, sessid, method, params, userInfo, methodUrl, responseStatusMessage, requestMethod, error;

/*
Expand Down Expand Up @@ -151,6 +147,8 @@ -(void) runMethod {
[requestBinary setRequestMethod:requestMethod];
[requestBinary addRequestHeader:@"Content-Type" value:@"application/plist"];
[requestBinary addRequestHeader:@"Accept" value:@"application/plist"];
[requestBinary setTimeOutSeconds:300];
[requestBinary setShouldRedirect:NO];
[requestBinary startSynchronous];
responseStatusMessage = [requestBinary responseStatusMessage];

Expand All @@ -174,6 +172,7 @@ -(void) runMethod {
code:1
userInfo:[NSDictionary dictionaryWithObject:errorStr forKey:NSLocalizedDescriptionKey]];
[self setError:e];
NSLog(@"error-response: %@", [requestBinary responseString]);
}
} else {
NSError *e = [NSError errorWithDomain:@"DIOS-Error"
Expand All @@ -187,14 +186,14 @@ -(void) runMethod {
[self setConnResult:plist];
if([[self method] isEqualToString:@"system.connect"]) {
if(plist != nil) {
[self setSessid:[[plist objectForKey:@"#data"] objectForKey:@"sessid"]];
[self setUserInfo:[[plist objectForKey:@"#data"]objectForKey:@"user"]];
[self setSessid:[plist objectForKey:@"sessid"]];
[self setUserInfo:[plist objectForKey:@"user"]];
}
}
if([[self method] isEqualToString:@"user.login"]) {
if(plist != nil) {
[self setSessid:[[plist objectForKey:@"#data"] objectForKey:@"sessid"]];
[self setUserInfo:[[plist objectForKey:@"#data"]objectForKey:@"user"]];
if(plist != nil) {
[self setSessid:[plist objectForKey:@"sessid"]];
[self setUserInfo:[plist objectForKey:@"user"]];
}
}
if([[self method] isEqualToString:@"user.logout"]) {
Expand All @@ -206,7 +205,9 @@ -(void) runMethod {
}
}


if(error) {
NSLog(@"%@", [error localizedDescription]);
}
//Bug in ASIHTTPRequest, put here to stop activity indicator
UIApplication* app = [UIApplication sharedApplication];
app.networkActivityIndicatorVisible = NO;
Expand Down
7 changes: 7 additions & 0 deletions DIOSNode.m
Expand Up @@ -58,6 +58,13 @@ -(NSDictionary *) nodeGet:(NSString *)nid {
-(NSDictionary *) nodeSave:(NSMutableDictionary *)node {
[self setMethod:@"node.save"];
[self setMethodUrl:@"node"];
if ([[[self userInfo] objectForKey:@"uid"] isEqualToNumber:[NSNumber numberWithInt:0]]) {
[node setObject:@"" forKey:@"name"];
} else if([self userInfo] == nil){
[node setObject:@"" forKey:@"name"];
} else {
[node setObject:[[self userInfo] objectForKey:@"name"] forKey:@"name"];
}
if ([node objectForKey:@"nid"] != nil && ![[node objectForKey:@"nid"] isEqualToString:@""]) {
[self setMethodUrl:[NSString stringWithFormat:@"node/%@", [node objectForKey:@"nid"]]];
[self setRequestMethod:@"PUT"];
Expand Down
2 changes: 1 addition & 1 deletion DIOSUser.m
Expand Up @@ -66,7 +66,7 @@ - (NSDictionary *) userSave:(NSMutableDictionary *)userDict {
}
for (NSString *key in userDict) {
[self addParam:[userDict objectForKey:key] forKey:key];
}
}
[self runMethod];
return [self connResult];
}
Expand Down

0 comments on commit fc5989d

Please sign in to comment.