IOSAD-160 Differ again for own identities on update IOSAD-160
authorDirk Zimmermann <dz@pep.security>
Tue, 03 Dec 2019 14:07:27 +0100
branchIOSAD-160
changeset 137386bc00f43015
parent 1372 ac119be204d2
child 1374 851c056db01f
IOSAD-160 Differ again for own identities on update
pEpObjCAdapter/PEPInternalSession.m
     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 @@ -565,20 +565,24 @@
     1.4  
     1.5  - (BOOL)updateIdentity:(PEPIdentity * _Nonnull)identity error:(NSError * _Nullable * _Nullable)error
     1.6  {
     1.7 -    pEp_identity *ident = PEP_identityToStruct(identity);
     1.8 +    if (identity.isOwn) {
     1.9 +        return [self mySelf:identity error:error];
    1.10 +    } else {
    1.11 +        pEp_identity *ident = PEP_identityToStruct(identity);
    1.12  
    1.13 -    PEPStatus status = (PEPStatus) update_identity(_session, ident);
    1.14 +        PEPStatus status = (PEPStatus) update_identity(_session, ident);
    1.15  
    1.16 -    if ([NSError setError:error fromPEPStatus:status]) {
    1.17 +        if ([NSError setError:error fromPEPStatus:status]) {
    1.18 +            free_identity(ident);
    1.19 +            return NO;
    1.20 +        }
    1.21 +
    1.22 +        [identity reset];
    1.23 +        [identity setValuesForKeysWithDictionary:PEP_identityDictFromStruct(ident)];
    1.24          free_identity(ident);
    1.25 -        return NO;
    1.26 +
    1.27 +        return YES;
    1.28      }
    1.29 -
    1.30 -    [identity reset];
    1.31 -    [identity setValuesForKeysWithDictionary:PEP_identityDictFromStruct(ident)];
    1.32 -    free_identity(ident);
    1.33 -
    1.34 -    return YES;
    1.35  }
    1.36  
    1.37  - (BOOL)trustPersonalKey:(PEPIdentity * _Nonnull)identity