is_own instead of deprecated OWN_USER_ID sync
authorVolker Birk <vb@pep.foundation>
Wed, 29 Aug 2018 20:38:40 +0200
branchsync
changeset 29010d30b013e1b2
parent 2900 7bef073c3952
child 2902 5692b0768f9e
is_own instead of deprecated OWN_USER_ID
sync/cond_act_sync.yml2
     1.1 --- a/sync/cond_act_sync.yml2	Wed Aug 29 17:18:40 2018 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Wed Aug 29 20:38:40 2018 +0200
     1.3 @@ -14,7 +14,7 @@
     1.4  
     1.5  condition deviceGrouped {
     1.6      call "exec_sql_int" with "sql"
     1.7 -        > "select count(*) from identity where user_id = '"PEP_OWN_USERID"' and (flags & 4) = 4;"
     1.8 +        > "select count(*) from identity where is_own = true and (flags & 4) = 4;"
     1.9      |> *result = _result > 0;
    1.10  }
    1.11  
    1.12 @@ -33,12 +33,14 @@
    1.13  ||
    1.14      pEp_identity *from = session->sync_state.common.from;
    1.15  
    1.16 -    assert(from && from->fpr && from->fpr[0] && from->address && from->address[0]);
    1.17 -    if (!(from && from->fpr && from->fpr[0] && from->address && from->address[0]))
    1.18 +    assert(from && from->fpr && from->fpr[0] && from->address &&
    1.19 +            from->address[0] && from->user_id && from->user_id[0]);
    1.20 +    if (!(from && from->fpr && from->fpr[0] && from->address &&
    1.21 +            from->address[0] && from->user_id && from->user_id[0]))
    1.22          return PEP_ILLEGAL_VALUE;
    1.23  
    1.24      pEp_identity *me = NULL;
    1.25 -    PEP_STATUS status = get_identity(session, from->address, PEP_OWN_USERID, &me);
    1.26 +    PEP_STATUS status = get_identity(session, from->address, from->user_id, &me);
    1.27      assert(status == PEP_STATUS_OK);
    1.28      if (status)
    1.29          return status;
    1.30 @@ -109,7 +111,7 @@
    1.31  
    1.32          pEp_identity *from = session->sync_state.common.from;
    1.33          pEp_identity *me = NULL;
    1.34 -        PEP_STATUS status = get_identity(session, from->address, PEP_OWN_USERID, &me);
    1.35 +        PEP_STATUS status = get_identity(session, from->address, from->user_id, &me);
    1.36          assert(status == PEP_STATUS_OK);
    1.37          if (status)
    1.38              return status;
    1.39 @@ -170,8 +172,8 @@
    1.40                  "   join pgp_keypair on fpr = identity.main_key_id"
    1.41                  "   join trust on id = trust.user_id"
    1.42                  "       and pgp_keypair_fpr = identity.main_key_id"
    1.43 +                "   where identity.is_own = true ;"
    1.44          ||
    1.45 -        >         "   where identity.user_id = '" PEP_OWN_USERID "';"
    1.46      }
    1.47  
    1.48      ||