merge default IOS-1576
authorbuff <andreas@pep-project.org>
Fri, 07 Jun 2019 17:15:38 +0200
branchIOS-1576
changeset 102022b3668ada3d
parent 986 8a2cde792980
parent 1019 c5da961c15f6
child 1021 676ed73d74f5
merge default
pEpObjCAdapter/PEPInternalSession.m
pEpObjCAdapter/PEPSession.m
pEpObjCAdapterFramework/PEPSessionProtocol.h
     1.1 --- a/pEpObjCAdapter.xcodeproj/project.pbxproj	Mon May 27 20:13:23 2019 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/project.pbxproj	Fri Jun 07 17:15:38 2019 +0200
     1.3 @@ -20,6 +20,7 @@
     1.4  		432FA2D41C884C5F00DDF874 /* partner2_F9D9CCD0A401311F_pub.asc in Resources */ = {isa = PBXBuildFile; fileRef = 432FA2D11C884C5F00DDF874 /* partner2_F9D9CCD0A401311F_pub.asc */; };
     1.5  		432FA2D71C884FF500DDF874 /* meATdontcare_E3BFBCA9248FC681_pub.asc in Resources */ = {isa = PBXBuildFile; fileRef = 432FA2D51C884FF500DDF874 /* meATdontcare_E3BFBCA9248FC681_pub.asc */; };
     1.6  		432FA2D81C884FF500DDF874 /* meATdontcare_E3BFBCA9248FC681_sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 432FA2D61C884FF500DDF874 /* meATdontcare_E3BFBCA9248FC681_sec.asc */; };
     1.7 +		4331CE94229C2AAF00DDDC65 /* PEPSizeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4331CE93229C2AAF00DDDC65 /* PEPSizeTest.m */; };
     1.8  		4336853F203D5CE60069A451 /* PEPTestUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 15D3D77C2010DDC500A0DA20 /* PEPTestUtils.m */; };
     1.9  		434226811D4F60000083ED79 /* PepTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 434226801D4F60000083ED79 /* PepTests.m */; };
    1.10  		435C0C8C22291FFB0025C6B5 /* PEPSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 15206CC51F8E078B003FF880 /* PEPSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
    1.11 @@ -162,6 +163,7 @@
    1.12  		432FA2D11C884C5F00DDF874 /* partner2_F9D9CCD0A401311F_pub.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = partner2_F9D9CCD0A401311F_pub.asc; sourceTree = "<group>"; };
    1.13  		432FA2D51C884FF500DDF874 /* meATdontcare_E3BFBCA9248FC681_pub.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = meATdontcare_E3BFBCA9248FC681_pub.asc; sourceTree = "<group>"; };
    1.14  		432FA2D61C884FF500DDF874 /* meATdontcare_E3BFBCA9248FC681_sec.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = meATdontcare_E3BFBCA9248FC681_sec.asc; sourceTree = "<group>"; };
    1.15 +		4331CE93229C2AAF00DDDC65 /* PEPSizeTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPSizeTest.m; sourceTree = "<group>"; };
    1.16  		433E28901FA741DE00E359B3 /* PEPIdentity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPIdentity.m; sourceTree = "<group>"; };
    1.17  		434226801D4F60000083ED79 /* PepTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PepTests.m; sourceTree = "<group>"; };
    1.18  		434ED6D4207E27B8000A7590 /* PEPAutoPointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPAutoPointer.h; sourceTree = "<group>"; };
    1.19 @@ -411,6 +413,7 @@
    1.20  				15D3D760200F61BB00A0DA20 /* PEPSessionProviderTest.m */,
    1.21  				152A9C462010F50400F962ED /* PEPSessionTest.m */,
    1.22  				64415E1B1BE94FCB00F6CBB2 /* Info.plist */,
    1.23 +				4331CE93229C2AAF00DDDC65 /* PEPSizeTest.m */,
    1.24  			);
    1.25  			path = pEpObjCTests;
    1.26  			sourceTree = "<group>";
    1.27 @@ -619,6 +622,7 @@
    1.28  			isa = PBXSourcesBuildPhase;
    1.29  			buildActionMask = 2147483647;
    1.30  			files = (
    1.31 +				4331CE94229C2AAF00DDDC65 /* PEPSizeTest.m in Sources */,
    1.32  				4396CECB2187220200FDD398 /* PEPSessionTestSendMessageDelegate.m in Sources */,
    1.33  				152D58EF201B6DB200036219 /* PEPMessageUtilTest.m in Sources */,
    1.34  				152A9C472010F50400F962ED /* PEPSessionTest.m in Sources */,
     2.1 --- a/pEpObjCAdapter/NSDictionary+CommType.m	Mon May 27 20:13:23 2019 +0200
     2.2 +++ b/pEpObjCAdapter/NSDictionary+CommType.m	Fri Jun 07 17:15:38 2019 +0200
     2.3 @@ -16,11 +16,11 @@
     2.4  
     2.5  @implementation NSDictionary (CommType)
     2.6  
     2.7 -- (PEP_comm_type)commType
     2.8 +- (PEPCommType)commType
     2.9  {
    2.10      NSNumber *ctNum = self[kPepCommType];
    2.11      if (!ctNum) {
    2.12 -        return PEP_ct_unknown;
    2.13 +        return PEPCommTypeUnknown;
    2.14      }
    2.15      return ctNum.intValue;
    2.16  }
     3.1 --- a/pEpObjCAdapter/PEPIdentity.m	Mon May 27 20:13:23 2019 +0200
     3.2 +++ b/pEpObjCAdapter/PEPIdentity.m	Fri Jun 07 17:15:38 2019 +0200
     3.3 @@ -43,7 +43,7 @@
     3.4                              fingerPrint:(NSString * _Nullable)fingerPrint
     3.5  {
     3.6      return [self initWithAddress:address userID:userID userName:userName isOwn:isOwn
     3.7 -                     fingerPrint:fingerPrint commType:PEP_ct_unknown language:nil];
     3.8 +                     fingerPrint:fingerPrint commType:PEPCommTypeUnknown language:nil];
     3.9  }
    3.10  
    3.11  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    3.12 @@ -52,13 +52,13 @@
    3.13                                    isOwn:(BOOL)isOwn
    3.14  {
    3.15      return [self initWithAddress:address userID:userID userName:userName
    3.16 -                           isOwn:isOwn fingerPrint:nil commType:PEP_ct_unknown language:nil];
    3.17 +                           isOwn:isOwn fingerPrint:nil commType:PEPCommTypeUnknown language:nil];
    3.18  }
    3.19  
    3.20  - (nonnull instancetype)initWithAddress:(NSString * _Nonnull)address
    3.21  {
    3.22      return [self initWithAddress:address userID:nil userName:nil isOwn:NO fingerPrint:nil
    3.23 -                        commType:PEP_ct_unknown language:nil];
    3.24 +                        commType:PEPCommTypeUnknown language:nil];
    3.25  }
    3.26  
    3.27  - (nonnull instancetype)initWithDictionary:(NSDictionary *)dictionary
    3.28 @@ -145,7 +145,7 @@
    3.29      return self.commType;
    3.30  }
    3.31  
    3.32 -- (void)setComm_type:(PEP_comm_type)ct
    3.33 +- (void)setComm_type:(PEPCommType)ct
    3.34  {
    3.35      self.commType = ct;
    3.36  }
     4.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Mon May 27 20:13:23 2019 +0200
     4.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Fri Jun 07 17:15:38 2019 +0200
     4.3 @@ -139,7 +139,7 @@
     4.4                                                        &_dst,
     4.5                                                        &theKeys,
     4.6                                                        (PEP_rating *) &internalRating,
     4.7 -                                                      &theFlags);
     4.8 +                                                      (PEP_decrypt_flags *) &theFlags);
     4.9      [self unlockWrite];
    4.10  
    4.11      if (status) {
    4.12 @@ -1026,4 +1026,18 @@
    4.13      }
    4.14  }
    4.15  
    4.16 +- (BOOL)leaveDeviceGroupError:(NSError * _Nullable * _Nullable)error
    4.17 +{
    4.18 +    PEPStatus status = (PEPStatus) leave_device_group(self.session);
    4.19 +
    4.20 +    if (status == PEPStatusOK) {
    4.21 +        return YES;
    4.22 +    } else {
    4.23 +        if (error) {
    4.24 +            *error = [NSError errorWithPEPStatus:status];
    4.25 +        }
    4.26 +        return NO;
    4.27 +    }
    4.28 +}
    4.29 +
    4.30  @end
     5.1 --- a/pEpObjCAdapter/PEPMessageUtil.h	Mon May 27 20:13:23 2019 +0200
     5.2 +++ b/pEpObjCAdapter/PEPMessageUtil.h	Fri Jun 07 17:15:38 2019 +0200
     5.3 @@ -23,18 +23,18 @@
     5.4   */
     5.5  PEPIdentity * _Nullable PEP_identityFromStruct(pEp_identity * _Nonnull ident);
     5.6  
     5.7 -NSArray<PEPIdentity *> *PEP_arrayFromIdentityList(identity_list *il);
     5.8 -identity_list *PEP_identityArrayToList(NSArray<PEPIdentity *> *array);
     5.9 +NSArray<PEPIdentity *> * _Nonnull PEP_arrayFromIdentityList(identity_list * _Nonnull il);
    5.10 +identity_list * _Nullable PEP_identityArrayToList(NSArray<PEPIdentity *> * _Nullable array);
    5.11  
    5.12  pEp_identity * _Nullable PEP_identityDictToStruct(NSDictionary * _Nullable dict);
    5.13  NSDictionary * _Nonnull PEP_identityDictFromStruct(pEp_identity * _Nullable ident);
    5.14  
    5.15  PEPMessage * _Nullable pEpMessageFromStruct(message * _Nullable msg);
    5.16  
    5.17 -message *PEP_messageToStruct(PEPMessage *message);
    5.18 +message * _Nullable PEP_messageToStruct(PEPMessage * _Nullable message);
    5.19  message * _Nullable PEP_messageDictToStruct(NSDictionary * _Nullable dict);
    5.20  NSDictionary * _Nonnull PEP_messageDictFromStruct(message * _Nullable msg);
    5.21  
    5.22 -NSArray *PEP_identityArrayFromList(identity_list *il);
    5.23 -NSArray *PEP_arrayFromStringPairlist(stringpair_list_t *sl);
    5.24 -NSArray *PEP_arrayFromBloblist(bloblist_t *bl);
    5.25 +NSArray * _Nonnull PEP_identityArrayFromList(identity_list * _Nonnull il);
    5.26 +NSArray * _Nonnull PEP_arrayFromStringPairlist(stringpair_list_t * _Nonnull sl);
    5.27 +NSArray * _Nonnull PEP_arrayFromBloblist(bloblist_t * _Nonnull bl);
     6.1 --- a/pEpObjCAdapter/PEPSession.m	Mon May 27 20:13:23 2019 +0200
     6.2 +++ b/pEpObjCAdapter/PEPSession.m	Fri Jun 07 17:15:38 2019 +0200
     6.3 @@ -386,4 +386,10 @@
     6.4      return [session keyReset:identity fingerprint:fingerprint error:error];
     6.5  }
     6.6  
     6.7 +- (BOOL)leaveDeviceGroupError:(NSError * _Nullable * _Nullable)error
     6.8 +{
     6.9 +    PEPInternalSession *session = [PEPSessionProvider session];
    6.10 +    return [session leaveDeviceGroupError:error];
    6.11 +}
    6.12 +
    6.13  @end
     7.1 --- a/pEpObjCAdapter/PEPSync.m	Mon May 27 20:13:23 2019 +0200
     7.2 +++ b/pEpObjCAdapter/PEPSync.m	Fri Jun 07 17:15:38 2019 +0200
     7.3 @@ -6,6 +6,8 @@
     7.4  //  Copyright © 2018 p≡p. All rights reserved.
     7.5  //
     7.6  
     7.7 +#import <os/log.h>
     7.8 +
     7.9  #import "PEPSync.h"
    7.10  
    7.11  #import "pEpEngine.h"
    7.12 @@ -35,6 +37,7 @@
    7.13  @property (nonatomic, nonnull) PEPQueue *queue;
    7.14  @property (nonatomic, nullable) NSThread *syncThread;
    7.15  @property (nonatomic, nullable) NSConditionLock *conditionLockForJoiningSyncThread;
    7.16 +@property (nonnull, readonly) os_log_t logger;
    7.17  
    7.18  /**
    7.19   @Return: The callback for message sending that should be used on every session init.
    7.20 @@ -154,6 +157,7 @@
    7.21                                               _Nonnull)notifyHandshakeDelegate
    7.22  {
    7.23      if (self = [super init]) {
    7.24 +        _logger = os_log_create("security.pEp.adapter", "PEPSync");
    7.25          _sendMessageDelegate = sendMessageDelegate;
    7.26          _notifyHandshakeDelegate = notifyHandshakeDelegate;
    7.27          _queue = [PEPQueue new];
    7.28 @@ -198,17 +202,30 @@
    7.29  {
    7.30      [self.conditionLockForJoiningSyncThread lock];
    7.31  
    7.32 +    os_log(self.logger, "trying to start the sync loop");
    7.33 +
    7.34      PEPInternalSession *session = [PEPSessionProvider session];
    7.35  
    7.36      if (session) {
    7.37 -        register_sync_callbacks(session.session, nil, s_notifyHandshake,
    7.38 -                                s_retrieve_next_sync_event);
    7.39 -        do_sync_protocol(session.session, nil);
    7.40 -        unregister_sync_callbacks(session.session);
    7.41 +        PEP_STATUS status = register_sync_callbacks(session.session, nil, s_notifyHandshake,
    7.42 +                                                    s_retrieve_next_sync_event);
    7.43 +        if (status == PEP_STATUS_OK) {
    7.44 +            status = do_sync_protocol(session.session, nil);
    7.45 +            if (status != PEP_STATUS_OK) {
    7.46 +                os_log_error(self.logger, "do_sync_protocol returned PEP_STATUS %d", status);
    7.47 +                os_log(self.logger, "sync loop is NOT running");
    7.48 +            }
    7.49 +            unregister_sync_callbacks(session.session);
    7.50 +        } else {
    7.51 +            os_log_error(self.logger, "register_sync_callbacks returned PEP_STATUS %d", status);
    7.52 +            os_log(self.logger, "sync loop is NOT running");
    7.53 +        }
    7.54      } else {
    7.55 -        // TODO: indicate error, maybe through `object`?
    7.56 +        os_log_error(self.logger, "could not create session for starting the sync loop");
    7.57      }
    7.58  
    7.59 +    os_log(self.logger, "sync loop finished");
    7.60 +
    7.61      session = nil;
    7.62  
    7.63      [self.conditionLockForJoiningSyncThread unlockWithCondition:YES];
    7.64 @@ -218,7 +235,7 @@
    7.65  {
    7.66      if (self.sendMessageDelegate) {
    7.67          PEPMessage *theMessage = pEpMessageFromStruct(msg);
    7.68 -        return [self.sendMessageDelegate sendMessage:theMessage];
    7.69 +        return (PEP_STATUS) [self.sendMessageDelegate sendMessage:theMessage];
    7.70      } else {
    7.71          return PEP_SYNC_NO_MESSAGE_SEND_CALLBACK;
    7.72      }
    7.73 @@ -237,10 +254,11 @@
    7.74      if (self.notifyHandshakeDelegate) {
    7.75          PEPIdentity *meIdentity = PEP_identityFromStruct(me);
    7.76          PEPIdentity *partnerIdentity = PEP_identityFromStruct(partner);
    7.77 -        return [self.notifyHandshakeDelegate notifyHandshake:NULL
    7.78 -                                                          me:meIdentity
    7.79 -                                                     partner:partnerIdentity
    7.80 -                                                      signal:(PEPSyncHandshakeSignal) signal];
    7.81 +        return (PEP_STATUS) [self.notifyHandshakeDelegate
    7.82 +                             notifyHandshake:NULL
    7.83 +                             me:meIdentity
    7.84 +                             partner:partnerIdentity
    7.85 +                             signal:(PEPSyncHandshakeSignal) signal];
    7.86      } else {
    7.87          return PEP_SYNC_NO_NOTIFY_CALLBACK;
    7.88      }
     8.1 --- a/pEpObjCAdapterFramework/PEPEngineTypes.h	Mon May 27 20:13:23 2019 +0200
     8.2 +++ b/pEpObjCAdapterFramework/PEPEngineTypes.h	Fri Jun 07 17:15:38 2019 +0200
     8.3 @@ -11,7 +11,7 @@
     8.4  
     8.5  #import <Foundation/Foundation.h>
     8.6  
     8.7 -typedef NS_ENUM(NSUInteger, PEPDecryptFlags) {
     8.8 +typedef NS_ENUM(int, PEPDecryptFlags) {
     8.9      PEPDecryptFlagsNone = 0x1, // This defined only in the adpater, not the engine.
    8.10      PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key = 0x1,
    8.11      PEPDecryptFlagsConsume = 0x2, // PEP_decrypt_flag_consume = 0x2,
    8.12 @@ -21,7 +21,7 @@
    8.13      PEPDecryptFlagsUntrustedServer = 0x100 // PEP_decrypt_flag_untrusted_server = 0x100
    8.14  }; // PEP_decrypt_flags;
    8.15  
    8.16 -typedef NS_ENUM(NSUInteger, PEPEncFormat) {
    8.17 +typedef NS_ENUM(int, PEPEncFormat) {
    8.18      PEPEncFormatNone = 0, // PEP_enc_none = 0, // message is not encrypted
    8.19      PEPEncFormatPieces, // PEP_enc_pieces, // inline PGP + PGP extensions
    8.20      PEPEncFormatSMIME, // PEP_enc_S_MIME, // RFC5751
    8.21 @@ -30,7 +30,7 @@
    8.22      PEPEncFormatPgpMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1 // Message B0rken by Outlook type 1
    8.23  };
    8.24  
    8.25 -typedef NS_ENUM(NSInteger, PEPRating) {
    8.26 +typedef NS_ENUM(int, PEPRating) {
    8.27      PEPRatingUndefined = 0,// PEP_rating_undefined = 0,
    8.28      PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt,
    8.29      PEPRatingHaveNoKey, // PEP_rating_have_no_key,
    8.30 @@ -47,7 +47,7 @@
    8.31      PEPRatingUnderAttack = -3 // PEP_rating_under_attack = -3
    8.32  };
    8.33  
    8.34 -typedef NS_ENUM(NSInteger, PEPStatus) {
    8.35 +typedef NS_ENUM(int, PEPStatus) {
    8.36      PEPStatusOK                                   = 0, // PEP_STATUS_OK
    8.37  
    8.38      PEPStatusInitCannotLoadGPME                      = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
    8.39 @@ -144,7 +144,7 @@
    8.40      PEPStatusVersionMismatch                            = -7, // PEP_VERSION_MISMATCH
    8.41  };
    8.42  
    8.43 -typedef NS_ENUM(NSUInteger, PEPIdentityFlags) {
    8.44 +typedef NS_ENUM(int, PEPIdentityFlags) {
    8.45      // the first octet flags are app defined settings
    8.46      PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync = 0x0001,   // don't use this identity for sync
    8.47      PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002,           // identity of list of persons
    8.48 @@ -152,7 +152,7 @@
    8.49      PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup = 0x0100     // identity of a device group member
    8.50  };
    8.51  
    8.52 -typedef NS_ENUM(NSInteger, PEPSyncHandshakeSignal) { // _sync_handshake_signal
    8.53 +typedef NS_ENUM(int, PEPSyncHandshakeSignal) { // _sync_handshake_signal
    8.54      PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED = 0,
    8.55  
    8.56      // request show handshake dialog
    8.57 @@ -177,13 +177,13 @@
    8.58      PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP = 255
    8.59  };
    8.60  
    8.61 -typedef NS_ENUM(NSInteger, PEPSyncHandshakeResult) {
    8.62 +typedef NS_ENUM(int, PEPSyncHandshakeResult) {
    8.63      PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL = -1,
    8.64      PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED = 0,
    8.65      PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED = 1
    8.66  };
    8.67  
    8.68 -typedef NS_ENUM(NSUInteger, PEPCommType) {
    8.69 +typedef NS_ENUM(int, PEPCommType) {
    8.70      PEPCommTypeUnknown = 0, // PEP_ct_unknown = 0,
    8.71  
    8.72      // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
    8.73 @@ -244,19 +244,19 @@
    8.74      PEPCommTypePEP = 0xff // PEP_ct_pEp = 0xff
    8.75  };
    8.76  
    8.77 -typedef NS_ENUM(NSUInteger, PEPMsgDirection) {
    8.78 +typedef NS_ENUM(int, PEPMsgDirection) {
    8.79      PEPMsgDirectionIncoming = 0,
    8.80      PEPMsgDirectionOutgoing
    8.81  };
    8.82  
    8.83 -typedef NS_ENUM(NSInteger, PEPColor) {
    8.84 +typedef NS_ENUM(int, PEPColor) {
    8.85      PEPColorNoColor = 0,
    8.86      PEPColorYellow,
    8.87      PEPColorGreen,
    8.88      PEPColorRed = -1,
    8.89  };
    8.90  
    8.91 -typedef NS_ENUM(NSInteger, PEPContentDisposition) {
    8.92 +typedef NS_ENUM(int, PEPContentDisposition) {
    8.93      PEPContentDispositionAttachment = 0,
    8.94      PEPContentDispositionInline = 1,
    8.95      PEPContentDispositionOther = -1      // must be affirmatively set
     9.1 --- a/pEpObjCAdapterFramework/PEPSessionProtocol.h	Mon May 27 20:13:23 2019 +0200
     9.2 +++ b/pEpObjCAdapterFramework/PEPSessionProtocol.h	Fri Jun 07 17:15:38 2019 +0200
     9.3 @@ -277,4 +277,7 @@
     9.4       fingerprint:(NSString * _Nullable)fingerprint
     9.5             error:(NSError * _Nullable * _Nullable)error;
     9.6  
     9.7 +/** Wraps leave_device_group. */
     9.8 +- (BOOL)leaveDeviceGroupError:(NSError * _Nullable * _Nullable)error;
     9.9 +
    9.10  @end
    10.1 --- a/pEpObjCTests/PEPSessionTest.m	Mon May 27 20:13:23 2019 +0200
    10.2 +++ b/pEpObjCTests/PEPSessionTest.m	Fri Jun 07 17:15:38 2019 +0200
    10.3 @@ -36,15 +36,12 @@
    10.4  
    10.5      [self pEpCleanUp];
    10.6  
    10.7 -    [self startSync];
    10.8 -
    10.9      [PEPObjCAdapter setUnEncryptedSubjectEnabled:NO];
   10.10  }
   10.11  
   10.12  - (void)tearDown
   10.13  {
   10.14 -    [self.sync shutdown];
   10.15 -
   10.16 +    [self shutdownSync];
   10.17      [self pEpCleanUp];
   10.18      [super tearDown];
   10.19  }
   10.20 @@ -836,16 +833,11 @@
   10.21  
   10.22      NSError *error = nil;
   10.23      NSString *trustwordsFull = [session getTrustwordsIdentity1:meOrig identity2:partner1Orig
   10.24 -                                                      language:nil full:YES error:&error];
   10.25 +                                                      language:@"en" full:YES error:&error];
   10.26      XCTAssertNil(error);
   10.27      XCTAssertEqualObjects(trustwordsFull,
   10.28                            @"EMERSON GASPER TOKENISM BOLUS COLLAGE DESPISE BEDDED ENCRYPTION IMAGINE BEDFORD");
   10.29  
   10.30 -    NSString *trustwordsFullEnglish = [session getTrustwordsIdentity1:meOrig identity2:partner1Orig
   10.31 -                                                             language:@"en" full:YES error:&error];
   10.32 -    XCTAssertNil(error);
   10.33 -    XCTAssertEqualObjects(trustwordsFullEnglish, trustwordsFull);
   10.34 -
   10.35      NSString *trustwordsUndefined = [session getTrustwordsIdentity1:meOrig identity2:partner1Orig
   10.36                                                             language:@"ZZ" full:YES error:&error];
   10.37      XCTAssertNotNil(error);
   10.38 @@ -1302,6 +1294,31 @@
   10.39      XCTAssertNotEqual(fprOriginal, fprAfterReset);
   10.40  }
   10.41  
   10.42 +#pragma mark - leave_device_group
   10.43 +
   10.44 +/** Leaving a device group is successful even though none exists. */
   10.45 +- (void)testSuccessfulLeaveDeviceGroup
   10.46 +{
   10.47 +    PEPSession *session = [PEPSession new];
   10.48 +
   10.49 +    PEPIdentity *identMe = [[PEPIdentity alloc]
   10.50 +                            initWithAddress:@"me-myself-and-i@pep-project.org"
   10.51 +                            userID:@"me-myself-and-i"
   10.52 +                            userName:@"pEp Me"
   10.53 +                            isOwn:YES];
   10.54 +    NSError *error = nil;
   10.55 +    XCTAssertTrue([session mySelf:identMe error:&error]);
   10.56 +    XCTAssertNil(error);
   10.57 +
   10.58 +    [self startSync];
   10.59 +
   10.60 +    error = nil;
   10.61 +    XCTAssertTrue([session leaveDeviceGroupError:&error]);
   10.62 +    XCTAssertNil(error);
   10.63 +
   10.64 +    [self shutdownSync];
   10.65 +}
   10.66 +
   10.67  #pragma mark - Helpers
   10.68  
   10.69  - (void)testSendMessageOnSession:(PEPSession *)session
   10.70 @@ -1318,7 +1335,7 @@
   10.71      XCTAssertTrue([session mySelf:identMe error:&error]);
   10.72      XCTAssertNil(error);
   10.73  
   10.74 -    [self reStartSync];
   10.75 +    [self startSync];
   10.76  
   10.77      XCTKVOExpectation *expHaveMessage = [[XCTKVOExpectation alloc]
   10.78                                           initWithKeyPath:@"lastMessage"
   10.79 @@ -1330,12 +1347,8 @@
   10.80      XCTAssertNotNil(self.sendMessageDelegate.lastMessage);
   10.81  
   10.82      XCTAssertEqual(self.sendMessageDelegate.messages.count, 1);
   10.83 -}
   10.84  
   10.85 -- (void)reStartSync
   10.86 -{
   10.87 -    [self.sync shutdown];
   10.88 -    [self startSync];
   10.89 +    [self shutdownSync];
   10.90  }
   10.91  
   10.92  - (void)startSync
   10.93 @@ -1349,6 +1362,11 @@
   10.94      [self.sync startup];
   10.95  }
   10.96  
   10.97 +- (void)shutdownSync
   10.98 +{
   10.99 +    [self.sync shutdown];
  10.100 +}
  10.101 +
  10.102  - (NSNumber * _Nullable)testOutgoingRatingForMessage:(PEPMessage * _Nonnull)theMessage
  10.103                                               session:(PEPSession *)session
  10.104                                                 error:(NSError * _Nullable * _Nullable)error
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/pEpObjCTests/PEPSizeTest.m	Fri Jun 07 17:15:38 2019 +0200
    11.3 @@ -0,0 +1,37 @@
    11.4 +//
    11.5 +//  PEPSizeTest.m
    11.6 +//  pEpObjCAdapterTests
    11.7 +//
    11.8 +//  Created by Dirk Zimmermann on 27.05.19.
    11.9 +//  Copyright © 2019 p≡p. All rights reserved.
   11.10 +//
   11.11 +
   11.12 +#import <XCTest/XCTest.h>
   11.13 +
   11.14 +#import "PEPObjCAdapterFramework.h"
   11.15 +
   11.16 +#import "pEpEngine.h"
   11.17 +#import "message_api.h"
   11.18 +#import "sync_api.h"
   11.19 +
   11.20 +@interface PEPSizeTest : XCTestCase
   11.21 +
   11.22 +@end
   11.23 +
   11.24 +@implementation PEPSizeTest
   11.25 +
   11.26 +- (void)testEnumSizes {
   11.27 +    XCTAssertEqual(sizeof(PEP_STATUS), sizeof(PEPStatus));
   11.28 +    XCTAssertEqual(sizeof(PEP_rating), sizeof(PEPRating));
   11.29 +    XCTAssertEqual(sizeof(PEP_decrypt_flags), sizeof(PEPDecryptFlags));
   11.30 +    XCTAssertEqual(sizeof(PEP_enc_format), sizeof(PEPEncFormat));
   11.31 +    XCTAssertEqual(sizeof(identity_flags), sizeof(PEPIdentityFlags));
   11.32 +    XCTAssertEqual(sizeof(sync_handshake_signal), sizeof(PEPSyncHandshakeSignal));
   11.33 +    XCTAssertEqual(sizeof(sync_handshake_result), sizeof(PEPSyncHandshakeResult));
   11.34 +    XCTAssertEqual(sizeof(PEP_comm_type), sizeof(PEPCommType));
   11.35 +    XCTAssertEqual(sizeof(PEP_msg_direction), sizeof(PEPMsgDirection));
   11.36 +    XCTAssertEqual(sizeof(PEP_color), sizeof(PEPColor));
   11.37 +    XCTAssertEqual(sizeof(content_disposition_type), sizeof(PEPContentDisposition));
   11.38 +}
   11.39 +
   11.40 +@end