Ok, best solution, wrap a key_rating function that gives an actual rating. ENGINE-581
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Tue, 25 Jun 2019 20:23:14 +0200
branchENGINE-581
changeset 387501d0bda44169
parent 3874 4a6244c5d36e
child 3876 739c8e54b738
child 3877 cad51de6ba9a
Ok, best solution, wrap a key_rating function that gives an actual rating.
src/message_api.c
src/message_api.h
     1.1 --- a/src/message_api.c	Tue Jun 25 19:56:59 2019 +0200
     1.2 +++ b/src/message_api.c	Tue Jun 25 20:23:14 2019 +0200
     1.3 @@ -3126,7 +3126,6 @@
     1.4  }
     1.5  
     1.6  static PEP_STATUS reconcile_sent_and_recv_info(message* src, message* inner_message) {
     1.7 -    PEP_STATUS status = PEP_STATUS_OK;
     1.8      if (!src || !inner_message)
     1.9          return PEP_ILLEGAL_VALUE;
    1.10          
    1.11 @@ -4194,6 +4193,21 @@
    1.12      return PEP_color_no_color;
    1.13  }
    1.14  
    1.15 +DYNAMIC_API PEP_STATUS get_rating_from_bare_key(
    1.16 +        PEP_SESSION session, 
    1.17 +        const char* fpr,
    1.18 +        PEP_rating* rating
    1.19 +    )
    1.20 +{
    1.21 +    PEP_comm_type comm_type = PEP_ct_unknown;
    1.22 +    *rating = PEP_rating_undefined;
    1.23 +    PEP_STATUS status = get_key_rating(session, fpr, &comm_type);
    1.24 +    if (status == PEP_STATUS_OK)
    1.25 +        *rating = _rating(comm_type);
    1.26 +    
    1.27 +    return status;    
    1.28 +}
    1.29 +
    1.30  /* [0-9]: 0x30 - 0x39; [A-F] = 0x41 - 0x46; [a-f] = 0x61 - 0x66 */
    1.31  static short asciihex_to_num(char a) {
    1.32      short conv_num = -1;
     2.1 --- a/src/message_api.h	Tue Jun 25 19:56:59 2019 +0200
     2.2 +++ b/src/message_api.h	Tue Jun 25 20:23:14 2019 +0200
     2.3 @@ -507,6 +507,23 @@
     2.4          PEP_rating *rating
     2.5      );
     2.6  
     2.7 +// get_rating_from_bare_key() - get the rating of a certain key (instead of just the comm_type)
     2.8 +//
     2.9 +//  parameters:
    2.10 +//
    2.11 +//      session (in)            session handle
    2.12 +//      fpr (in)                string with fingerprint
    2.13 +//      rating (out)            rating of key for this user
    2.14 +//
    2.15 +//  returns:
    2.16 +//      status from get_key_rating, which only returns comm_type.
    2.17 +
    2.18 +DYNAMIC_API PEP_STATUS get_rating_from_bare_key(
    2.19 +        PEP_SESSION session, 
    2.20 +        const char* fpr,
    2.21 +        PEP_rating* rating
    2.22 +    );
    2.23 +
    2.24  #ifdef __cplusplus
    2.25  }
    2.26  #endif