Added set_as_pep_user to set trust
authorKrista Bennett <krista@pep-project.org>
Fri, 09 Feb 2018 09:03:11 +0100
changeset 24914852c6c94029
parent 2490 a527d621b486
child 2492 323e040d1a17
Added set_as_pep_user to set trust
src/pEpEngine.c
     1.1 --- a/src/pEpEngine.c	Fri Feb 09 08:14:27 2018 +0100
     1.2 +++ b/src/pEpEngine.c	Fri Feb 09 09:03:11 2018 +0100
     1.3 @@ -2246,13 +2246,19 @@
     1.4  
     1.5  PEP_STATUS _set_trust_internal(PEP_SESSION session, pEp_identity* identity,
     1.6                                 bool guard_transaction) {
     1.7 -    return set_or_update_with_identity(session, identity,
     1.8 -                                       _set_or_update_trust,
     1.9 -                                       exists_trust_entry,
    1.10 -                                       session->update_trust,
    1.11 -                                       session->set_trust,
    1.12 -                                       guard_transaction);
    1.13 +    PEP_STATUS status = set_or_update_with_identity(session, identity,
    1.14 +                                                    _set_or_update_trust,
    1.15 +                                                    exists_trust_entry,
    1.16 +                                                    session->update_trust,
    1.17 +                                                    session->set_trust,
    1.18 +                                                    guard_transaction);
    1.19 +    if (status == PEP_STATUS_OK) {
    1.20 +        if ((identity->comm_type | PEP_ct_confirmed) == PEP_ct_pEp)
    1.21 +            status = set_as_pep_user(session, identity);
    1.22 +    }
    1.23 +    return status;
    1.24  }
    1.25 +
    1.26  PEP_STATUS set_trust(PEP_SESSION session, pEp_identity* identity) {
    1.27      return _set_trust_internal(session, identity, true);
    1.28  }
    1.29 @@ -2372,10 +2378,9 @@
    1.30  
    1.31      assert(session);
    1.32      assert(user);
    1.33 -    assert(user->address);
    1.34      assert(!EMPTYSTR(user->user_id));
    1.35          
    1.36 -    if (!session || !user || user->address || EMPTYSTR(user->user_id))
    1.37 +    if (!session || !user || EMPTYSTR(user->user_id))
    1.38          return PEP_ILLEGAL_VALUE;
    1.39              
    1.40      PEP_STATUS status = PEP_STATUS_OK;