IOSAD-163 Use disable_identity_for_sync() after myself IOSAD-163
authorDirk Zimmermann <dz@pep.security>
Wed, 08 Jan 2020 13:36:06 +0100
branchIOSAD-163
changeset 1381e2654facfd29
parent 1380 16ab750dfe6a
child 1382 4a37f6aaff39
IOSAD-163 Use disable_identity_for_sync() after myself
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Wed Jan 08 10:59:16 2020 +0100
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Wed Jan 08 13:36:06 2020 +0100
     1.3 @@ -549,10 +549,6 @@
     1.4           error:(NSError * _Nullable * _Nullable)error {
     1.5      pEp_identity *ident = PEP_identityToStruct(identity);
     1.6  
     1.7 -    if (!pEpSyncEnabled) {
     1.8 -        ident->flags |= PEP_idf_not_for_sync;
     1.9 -    }
    1.10 -
    1.11      PEPStatus status = (PEPStatus) myself(_session, ident);
    1.12  
    1.13      if ([NSError setError:error fromPEPStatus:status]) {
    1.14 @@ -560,6 +556,20 @@
    1.15          return NO;
    1.16      }
    1.17  
    1.18 +    if (!pEpSyncEnabled) {
    1.19 +        // If pEp sync shall be disabled for the given identity,
    1.20 +        // immediately announce this to the engine.
    1.21 +        // If myself ever receives an additional parameter for deciding that,
    1.22 +        // use it.
    1.23 +        // See  https://pep.foundation/jira/browse/ENGINE-675?focusedCommentId=26860&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-26860
    1.24 +        BOOL success = [self disableSyncForIdentity:identity error:error];
    1.25 +
    1.26 +        if (!success) {
    1.27 +            free_identity(ident);
    1.28 +            return NO;
    1.29 +        }
    1.30 +    }
    1.31 +
    1.32      [identity reset];
    1.33      [identity setValuesForKeysWithDictionary:PEP_identityDictFromStruct(ident)];
    1.34      free_identity(ident);