From e7fcb3f02092f1ac136344a54298e87798428860 Mon Sep 17 00:00:00 2001 From: Siqi LIU Date: Thu, 21 Nov 2013 00:56:48 +0100 Subject: backward compatible with older serverend impl, ie without vers info Change-Id: I7b6597269778c20b8ed27d3eab6b4c80257b4ead --- ios/iosremote/iosremote/Communication/Client.m | 2 +- ios/iosremote/iosremote/Communication/CommandInterpreter.m | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'ios') diff --git a/ios/iosremote/iosremote/Communication/Client.m b/ios/iosremote/iosremote/Communication/Client.m index f675349d1668..d85cf5764a15 100644 --- a/ios/iosremote/iosremote/Communication/Client.m +++ b/ios/iosremote/iosremote/Communication/Client.m @@ -207,7 +207,7 @@ int count = 0; backgroundQueue = dispatch_queue_create("com.libreoffice.iosremote", DISPATCH_QUEUE_CONCURRENT); dispatch_async(backgroundQueue, ^(void) { NSArray *commands = [str componentsSeparatedByString:@"\n"]; - NSLog(@"Commands: %@", commands); +// NSLog(@"Commands: %@", commands); [self.receiver parse:commands]; }); data = nil; diff --git a/ios/iosremote/iosremote/Communication/CommandInterpreter.m b/ios/iosremote/iosremote/Communication/CommandInterpreter.m index 7dadfda07d47..af9902fd6494 100644 --- a/ios/iosremote/iosremote/Communication/CommandInterpreter.m +++ b/ios/iosremote/iosremote/Communication/CommandInterpreter.m @@ -52,9 +52,17 @@ dispatch_queue_t backgroundQueue; else if ([instruction isEqualToString:STATUS_PAIRING_PAIRED]){ [[NSNotificationCenter defaultCenter] postNotificationName:STATUS_PAIRING_PAIRED object:nil]; - [[[[CommunicationManager sharedComManager] client] server] setServerVersion:[command objectAtIndex:3]]; + // if LibO sends its remote server version, than this command should contain more than 3 items, we retrieve the version code and save it as a property of the server + if ([command count] > 3 && ![[command objectAtIndex:3] isEqualToString:@""]){ + [[[[CommunicationManager sharedComManager] client] server] setServerVersion:[command objectAtIndex:3]]; + marker = 4; + } else { + // Otherwise, we mark 3 as the end of this command (i.e. there is no version code sent to the client. + [[[[CommunicationManager sharedComManager] client] server] setServerVersion:@"Unspecified"]; + marker = 3; + } + // print out server info with server version / or unspecified if didn't receive it from the server NSLog(@"Connected to %@", [[[CommunicationManager sharedComManager] client] server].description); - marker = 4; } else if([instruction isEqualToString:@"slideshow_started"]){ uint slideLength = [[command objectAtIndex:1] integerValue]; @@ -115,7 +123,7 @@ dispatch_queue_t backgroundQueue; } } - if ([command objectAtIndex:marker] && ![[command objectAtIndex:marker] isEqualToString:@""]) + if ([command count] > marker && ![[command objectAtIndex:marker] isEqualToString:@""]) { NSRange range; range.location = marker; -- cgit v1.2.3