IOSAD-160 Add 2nd myself instead of changing the original one IOSAD-160
authorDirk Zimmermann <dz@pep.security>
Tue, 03 Dec 2019 14:07:27 +0100
branchIOSAD-160
changeset 1372ac119be204d2
parent 1371 3fa5bcebb17b
child 1373 86bc00f43015
IOSAD-160 Add 2nd myself instead of changing the original one
pEpObjCAdapter/PEPInternalSession.m
pEpObjCAdapter/PEPSession.m
pEpObjCAdapterFramework/PEPSessionProtocol.h
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Tue Dec 03 14:07:27 2019 +0100
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Tue Dec 03 14:07:27 2019 +0100
     1.3 @@ -536,6 +536,15 @@
     1.4  }
     1.5  
     1.6  - (BOOL)mySelf:(PEPIdentity * _Nonnull)identity
     1.7 +         error:(NSError * _Nullable * _Nullable)error
     1.8 +{
     1.9 +    // The default for pEpSyncEnabled is YES, that means the adapter
    1.10 +    // will not change the engine identity in that regard after new_identity
    1.11 +    // (called by PEP_identityToStruct).
    1.12 +    return [self mySelf:identity pEpSyncEnabled:YES error:error];
    1.13 +}
    1.14 +
    1.15 +- (BOOL)mySelf:(PEPIdentity * _Nonnull)identity
    1.16  pEpSyncEnabled:(BOOL)pEpSyncEnabled
    1.17           error:(NSError * _Nullable * _Nullable)error {
    1.18      pEp_identity *ident = PEP_identityToStruct(identity);
     2.1 --- a/pEpObjCAdapter/PEPSession.m	Tue Dec 03 14:07:27 2019 +0100
     2.2 +++ b/pEpObjCAdapter/PEPSession.m	Tue Dec 03 14:07:27 2019 +0100
     2.3 @@ -173,6 +173,13 @@
     2.4  }
     2.5  
     2.6  - (BOOL)mySelf:(PEPIdentity * _Nonnull)identity
     2.7 +         error:(NSError * _Nullable * _Nullable)error {
     2.8 +    PEPInternalSession *session = [PEPSessionProvider session];
     2.9 +    RETURN_ON_ERROR(session, error, NO);
    2.10 +    return [session mySelf:identity error:error];
    2.11 +}
    2.12 +
    2.13 +- (BOOL)mySelf:(PEPIdentity * _Nonnull)identity
    2.14  pEpSyncEnabled:(BOOL)pEpSyncEnabled
    2.15           error:(NSError * _Nullable * _Nullable)error {
    2.16      PEPInternalSession *session = [PEPSessionProvider session];
     3.1 --- a/pEpObjCAdapterFramework/PEPSessionProtocol.h	Tue Dec 03 14:07:27 2019 +0100
     3.2 +++ b/pEpObjCAdapterFramework/PEPSessionProtocol.h	Tue Dec 03 14:07:27 2019 +0100
     3.3 @@ -85,7 +85,19 @@
     3.4                                        shortened:(BOOL)shortened
     3.5                                            error:(NSError * _Nullable * _Nullable)error;
     3.6  
     3.7 -/// Marks an identity as an own identity.
     3.8 +/// Marks an identity as an own identity, not changing its participation in pEp sync.
     3.9 +///
    3.10 +/// @return Returns YES on success, NO on error, setting `*error` accordingly if possible.
    3.11 +///
    3.12 +/// @note See the engine's myself function for details.
    3.13 +///
    3.14 +/// @param identity The identity to mark as own.
    3.15 +///
    3.16 +/// @param error Standard cocoa error handling.
    3.17 +- (BOOL)mySelf:(PEPIdentity * _Nonnull)identity
    3.18 +         error:(NSError * _Nullable * _Nullable)error;
    3.19 +
    3.20 +/// Marks an identity as an own identity, and decides about participation in pEp sync.
    3.21  ///
    3.22  /// @return Returns YES on success, NO on error, setting `*error` accordingly if possible.
    3.23  ///