rating for decrypt() corrected
authorVolker Birk <vb@pep-project.org>
Mon, 28 Sep 2015 22:13:57 +0200
changeset 35830094a44f239
parent 357 9b796d54b0ea
child 359 87697fcab6ce
rating for decrypt() corrected
src/message_api.c
     1.1 --- a/src/message_api.c	Mon Sep 28 15:06:07 2015 +0200
     1.2 +++ b/src/message_api.c	Mon Sep 28 22:13:57 2015 +0200
     1.3 @@ -1058,16 +1058,32 @@
     1.4          if (_keylist)
     1.5              kl_color = keylist_color(session, _keylist);
     1.6  
     1.7 -        if (kl_color == PEP_rating_under_attack)
     1.8 +        if (kl_color == PEP_rating_under_attack) {
     1.9              *color = PEP_rating_under_attack;
    1.10 -
    1.11 +        }
    1.12 +        else if (*color >= PEP_rating_reliable &&
    1.13 +               kl_color < PEP_rating_reliable) {
    1.14 +            *color = PEP_rating_unreliable;
    1.15 +        }
    1.16          else if (*color >= PEP_rating_reliable &&
    1.17 -                kl_color < PEP_rating_reliable)
    1.18 -            *color = PEP_rating_unreliable;
    1.19 -
    1.20 -        else if (*color >= PEP_rating_reliable &&
    1.21 -                kl_color >= PEP_rating_trusted)
    1.22 -            *color = kl_color;
    1.23 +               kl_color == PEP_rating_reliable) {
    1.24 +            if (!(src->from && src->from->user_id && src->from->user_id[0])) {
    1.25 +                *color = PEP_rating_unreliable;
    1.26 +            }
    1.27 +            else {
    1.28 +                char *fpr = _keylist->value;
    1.29 +                pEp_identity *_from = new_identity(src->from->address, fpr,
    1.30 +                        src->from->user_id, src->from->username);
    1.31 +                if (_from == NULL)
    1.32 +                    goto enomem;
    1.33 +                status = update_identity(session, _from);
    1.34 +                if (_from->comm_type != PEP_ct_unknown)
    1.35 +                    *color = _rating(_from->comm_type);
    1.36 +                free_identity(_from);
    1.37 +                if (status != PEP_STATUS_OK)
    1.38 +                    goto pep_error;
    1.39 +            }
    1.40 +        }
    1.41      }
    1.42  
    1.43      if (ptext) {