better saveGroupKeys() sync
authorVolker Birk <vb@pep-project.org>
Thu, 30 May 2019 11:02:36 +0200
branchsync
changeset 3785a654da1d7c7c
parent 3783 119aba513e36
child 3786 008dfd0ca85f
better saveGroupKeys()
sync/cond_act_sync.yml2
     1.1 --- a/sync/cond_act_sync.yml2	Thu May 30 00:01:52 2019 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Thu May 30 11:02:36 2019 +0200
     1.3 @@ -361,7 +361,28 @@
     1.4      
     1.5      // BUG: this should be a transaction and been rolled back completely on error
     1.6      for (identity_list *_il = il; _il && _il->ident; _il = _il->next) {
     1.7 -        PEP_STATUS status = set_identity(session, _il->ident);
     1.8 +        pEp_identity *ident = _il->ident;
     1.9 +        bool is_own_already = false;
    1.10 +
    1.11 +        PEP_STATUS status = is_own_address(session, ident->address, &is_own_already);
    1.12 +        if (status) {
    1.13 +            free_identity_list(il);
    1.14 +            return status;
    1.15 +        }
    1.16 +
    1.17 +        if (is_own_already) {
    1.18 +            char *user_id = NULL;
    1.19 +            status = get_default_own_userid(session, &user_id);
    1.20 +            if (!status) {
    1.21 +                free(ident->user_id);
    1.22 +                ident->user_id = user_id;
    1.23 +                ident->comm_type = PEP_ct_pEp;
    1.24 +                status = set_trust(session, ident);
    1.25 +            }
    1.26 +        }
    1.27 +        else {
    1.28 +            status = myself(session, ident);
    1.29 +        }
    1.30          if (status) {
    1.31              free_identity_list(il);
    1.32              return status;