summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorSiqi LIU <me@siqi.fr>2013-11-21 00:56:48 +0100
committerSiqi LIU <me@siqi.fr>2013-11-21 00:59:57 +0100
commite7fcb3f02092f1ac136344a54298e87798428860 (patch)
tree7182c95d401b4cba175960a841b0276e9c4a5d25 /ios
parentec11f022cc1bb2857b20ff96af1f37ca49b73b00 (diff)
backward compatible with older serverend impl, ie without vers info
Change-Id: I7b6597269778c20b8ed27d3eab6b4c80257b4ead
Diffstat (limited to 'ios')
-rw-r--r--ios/iosremote/iosremote/Communication/Client.m2
-rw-r--r--ios/iosremote/iosremote/Communication/CommandInterpreter.m14
2 files changed, 12 insertions, 4 deletions
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;