From 27a8c28da4e5c62d8863ee3d30642109d713c4d6 Mon Sep 17 00:00:00 2001
From: manuroe <manu@matrix.org>
Date: Mon, 7 Nov 2016 17:27:09 +0100
Subject: [PATCH] OLMKit: Update obj-c wrapper to 2.0.0

---
 OLMKit.podspec                         |  4 ++--
 xcode/OLMKit.xcodeproj/project.pbxproj |  4 ++--
 xcode/OLMKit/OLMInboundGroupSession.h  |  2 +-
 xcode/OLMKit/OLMInboundGroupSession.m  |  4 ++--
 xcode/OLMKitTests/OLMKitGroupTests.m   |  4 +++-
 xcode/Podfile.lock                     | 14 +++++++-------
 6 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/OLMKit.podspec b/OLMKit.podspec
index 3c56773..0877e3a 100644
--- a/OLMKit.podspec
+++ b/OLMKit.podspec
@@ -1,8 +1,8 @@
 Pod::Spec.new do |s|
 
   # The libolm version
-  MAJOR = 1
-  MINOR = 3
+  MAJOR = 2
+  MINOR = 0
   PATCH = 0
 
   s.name         = "OLMKit"
diff --git a/xcode/OLMKit.xcodeproj/project.pbxproj b/xcode/OLMKit.xcodeproj/project.pbxproj
index fa02539..0ec7587 100644
--- a/xcode/OLMKit.xcodeproj/project.pbxproj
+++ b/xcode/OLMKit.xcodeproj/project.pbxproj
@@ -273,7 +273,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n    cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n    exit 1\nfi\n";
+			shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n";
 			showEnvVarsInLog = 0;
 		};
 		793D0533290528B7C0E17CAD /* [CP] Copy Pods Resources */ = {
@@ -303,7 +303,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n    cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n    exit 1\nfi\n";
+			shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n";
 			showEnvVarsInLog = 0;
 		};
 /* End PBXShellScriptBuildPhase section */
diff --git a/xcode/OLMKit/OLMInboundGroupSession.h b/xcode/OLMKit/OLMInboundGroupSession.h
index a507490..46de3a0 100644
--- a/xcode/OLMKit/OLMInboundGroupSession.h
+++ b/xcode/OLMKit/OLMInboundGroupSession.h
@@ -24,6 +24,6 @@
 - (NSString*)sessionIdentifier;
 
 /** base64 ciphertext -> UTF-8 plaintext */
-- (NSString*)decryptMessage:(NSString*)message;
+- (NSString*)decryptMessage:(NSString*)message messageIndex:(NSUInteger*)messageIndex;
 
 @end
diff --git a/xcode/OLMKit/OLMInboundGroupSession.m b/xcode/OLMKit/OLMInboundGroupSession.m
index d95d1ab..ea79e14 100644
--- a/xcode/OLMKit/OLMInboundGroupSession.m
+++ b/xcode/OLMKit/OLMInboundGroupSession.m
@@ -79,7 +79,7 @@
     return idString;
 }
 
-- (NSString *)decryptMessage:(NSString *)message
+- (NSString *)decryptMessage:(NSString *)message messageIndex:(NSUInteger*)messageIndex
 {
     NSParameterAssert(message != nil);
     NSData *messageData = [message dataUsingEncoding:NSUTF8StringEncoding];
@@ -96,7 +96,7 @@
     // message buffer is destroyed by olm_group_decrypt_max_plaintext_length
     mutMessage = messageData.mutableCopy;
     NSMutableData *plaintextData = [NSMutableData dataWithLength:maxPlaintextLength];
-    size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length);
+    size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length, messageIndex);
     if (plaintextLength == olm_error()) {
         const char *error = olm_inbound_group_session_last_error(session);
         NSAssert(NO, @"olm_group_decrypt error: %s", error);
diff --git a/xcode/OLMKitTests/OLMKitGroupTests.m b/xcode/OLMKitTests/OLMKitGroupTests.m
index 9f5ad10..cdfb704 100644
--- a/xcode/OLMKitTests/OLMKitGroupTests.m
+++ b/xcode/OLMKitTests/OLMKitGroupTests.m
@@ -55,8 +55,10 @@
     OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:sessionKey];
     XCTAssertEqualObjects(aliceSession.sessionIdentifier, bobSession.sessionIdentifier);
 
-    NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg];
+    NSUInteger messageIndex;
+    NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg messageIndex:&messageIndex];
     XCTAssertEqualObjects(message, plaintext);
+    XCTAssertEqual(messageIndex, 0);
 }
 
 - (void)testOutboundGroupSessionSerialization {
diff --git a/xcode/Podfile.lock b/xcode/Podfile.lock
index b091109..3ac110a 100644
--- a/xcode/Podfile.lock
+++ b/xcode/Podfile.lock
@@ -1,9 +1,9 @@
 PODS:
-  - OLMKit (1.3.0):
-    - OLMKit/olmc (= 1.3.0)
-    - OLMKit/olmcpp (= 1.3.0)
-  - OLMKit/olmc (1.3.0)
-  - OLMKit/olmcpp (1.3.0)
+  - OLMKit (2.0.0):
+    - OLMKit/olmc (= 2.0.0)
+    - OLMKit/olmcpp (= 2.0.0)
+  - OLMKit/olmc (2.0.0)
+  - OLMKit/olmcpp (2.0.0)
 
 DEPENDENCIES:
   - OLMKit (from `../OLMKit.podspec`)
@@ -13,8 +13,8 @@ EXTERNAL SOURCES:
     :path: ../OLMKit.podspec
 
 SPEC CHECKSUMS:
-  OLMKit: 49b73677a77988cc25e51d023f39a8a3e451cb23
+  OLMKit: ed17cdf7695bc0de1e2bf98243eb65f5b9ddebc1
 
 PODFILE CHECKSUM: 4e261dae61d833ec5585ced2473023b98909fd35
 
-COCOAPODS: 1.0.1
+COCOAPODS: 1.1.1
-- 
GitLab