Created
July 16, 2012 03:42
-
-
Save gholias/3120333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) parseResponseFromServer:(NSString*) output { | |
NSMutableDictionary* dict = [output objectFromJSONString]; | |
NSMutableDictionary* theData; | |
int output_code = [[dict objectForKey:@"c"] intValue]; | |
BOOL bStatus = [[dict objectForKey:@"s"] boolValue]; | |
switch (output_code) { | |
case kConnect: | |
sUser = [dict objectForKey:@"u"]; | |
debugLabel.text = [NSString stringWithFormat: @"Connected as %@", sUser]; | |
btnLogin.hidden = false; | |
break; | |
case kLoginDone: | |
debugLabel.text = [NSString stringWithFormat: @"login status: %@", (bStatus)?@"True":@"False"]; | |
btnListChannels.hidden = false; | |
break; | |
case kListChannelsDone: | |
theData = [dict objectForKey:@"d"]; | |
NSMutableArray* tables = [theData objectForKey:@"tables"]; | |
NSString* msg = @"Channels: "; | |
int c = 1; | |
for(NSDictionary* d in tables) { | |
msg =[NSString stringWithFormat: @"%@ \n%d - %@(%@)", msg, c++, [d objectForKey:@"name"], [d objectForKey:@"id"]]; | |
} | |
debugLabel.text = msg; | |
break; | |
default: | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment