merging
authorVolker Birk <vb@pep.foundation>
Fri, 19 Jan 2018 15:50:16 +0100
changeset 24225efcfbac57cd
parent 2421 0c03210e9071
parent 2420 b022b37d6d92
child 2423 788254d67314
merging
     1.1 --- a/src/message_api.c	Fri Jan 19 15:49:57 2018 +0100
     1.2 +++ b/src/message_api.c	Fri Jan 19 15:50:16 2018 +0100
     1.3 @@ -933,7 +933,10 @@
     1.4      for (id_list_ptr = list; id_list_ptr; id_list_ptr = id_list_ptr->next) {
     1.5          pEp_identity* curr_identity = id_list_ptr->ident;
     1.6          if (curr_identity) {
     1.7 -            status = update_identity(session, curr_identity);
     1.8 +            if (!is_me(session, curr_identity))
     1.9 +                status = update_identity(session, curr_identity);
    1.10 +            else
    1.11 +                status = myself(session, curr_identity);
    1.12          if (status == PEP_ILLEGAL_VALUE || status == PEP_OUT_OF_MEMORY)
    1.13              return status;
    1.14          }
    1.15 @@ -1230,13 +1233,17 @@
    1.16      return rating;
    1.17  }
    1.18  
    1.19 +// Internal function WARNING:
    1.20 +// Only call this on an ident that might have its FPR set from retrieval!
    1.21 +// (or on one without an fpr)
    1.22 +// We do not want myself() setting the fpr here.
    1.23  static PEP_comm_type _get_comm_type(
    1.24      PEP_SESSION session,
    1.25      PEP_comm_type max_comm_type,
    1.26      pEp_identity *ident
    1.27      )
    1.28  {
    1.29 -    PEP_STATUS status = update_identity(session, ident);
    1.30 +    PEP_STATUS status = PEP_STATUS_OK;
    1.31  
    1.32      if (max_comm_type == PEP_ct_compromized)
    1.33          return PEP_ct_compromized;
    1.34 @@ -1244,6 +1251,11 @@
    1.35      if (max_comm_type == PEP_ct_mistrusted)
    1.36          return PEP_ct_mistrusted;
    1.37  
    1.38 +    if (!is_me(session, ident))
    1.39 +        status = update_identity(session, ident);
    1.40 +    else
    1.41 +        status = myself(session, ident);
    1.42 +
    1.43      if (status == PEP_STATUS_OK) {
    1.44          if (ident->comm_type == PEP_ct_compromized)
    1.45              return PEP_ct_compromized;
    1.46 @@ -1499,7 +1511,11 @@
    1.47              return PEP_ILLEGAL_VALUE;
    1.48          }
    1.49  
    1.50 -        PEP_STATUS _status = update_identity(session, _il->ident);
    1.51 +        PEP_STATUS _status = PEP_STATUS_OK;
    1.52 +        if (!is_me(session, _il->ident))
    1.53 +            _status = update_identity(session, _il->ident);
    1.54 +        else
    1.55 +            _status = myself(session, _il->ident);
    1.56          if (_status != PEP_STATUS_OK) {
    1.57              status = _status;
    1.58              GOTO(pep_error);
    1.59 @@ -1520,7 +1536,11 @@
    1.60      else
    1.61      {
    1.62          for (_il = src->to; _il && _il->ident; _il = _il->next) {
    1.63 -            PEP_STATUS _status = update_identity(session, _il->ident);
    1.64 +            PEP_STATUS _status = PEP_STATUS_OK;
    1.65 +            if (!is_me(session, _il->ident))
    1.66 +                _status = update_identity(session, _il->ident);
    1.67 +            else
    1.68 +                _status = myself(session, _il->ident);
    1.69              if (_status != PEP_STATUS_OK) {
    1.70                  status = _status;
    1.71                  GOTO(pep_error);
    1.72 @@ -1540,7 +1560,11 @@
    1.73          }
    1.74  
    1.75          for (_il = src->cc; _il && _il->ident; _il = _il->next) {
    1.76 -            PEP_STATUS _status = update_identity(session, _il->ident);
    1.77 +            PEP_STATUS _status = PEP_STATUS_OK;
    1.78 +            if (!is_me(session, _il->ident))
    1.79 +                _status = update_identity(session, _il->ident);
    1.80 +            else
    1.81 +                _status = myself(session, _il->ident);
    1.82              if (_status != PEP_STATUS_OK)
    1.83              {
    1.84                  status = _status;
    1.85 @@ -1792,7 +1816,10 @@
    1.86      PEP_STATUS status;
    1.87  
    1.88      if (src->from && src->from->address) {
    1.89 -        status = update_identity(session, src->from);
    1.90 +        if (!is_me(session, src->from))
    1.91 +            status = update_identity(session, src->from);
    1.92 +        else
    1.93 +            status = myself(session, src->from);
    1.94          if (status == PEP_STATUS_OK
    1.95                  && is_a_pEpmessage(src)
    1.96                  && src->from->comm_type >= PEP_ct_OpenPGP_unconfirmed
    1.97 @@ -2603,8 +2630,12 @@
    1.98                                              // FIXME: free msg, but check references
    1.99                                              src = msg = inner_message;
   1.100                                              
   1.101 -                                            if (src->from)
   1.102 -                                                update_identity(session, src->from);
   1.103 +                                            if (src->from) {
   1.104 +                                                if (!is_me(session, src->from))
   1.105 +                                                    update_identity(session, (src->from));
   1.106 +                                                else
   1.107 +                                                    myself(session, src->from);
   1.108 +                                            }
   1.109                                              break;        
   1.110                                          }
   1.111                                          else { // should never happen
   1.112 @@ -3209,14 +3240,15 @@
   1.113  
   1.114      // MIME decode message delivers only addresses. We need more.
   1.115      if (tmp_msg->from) {
   1.116 -        status = update_identity(session, tmp_msg->from);
   1.117 +        if (!is_me(session, tmp_msg->from))
   1.118 +            status = update_identity(session, (tmp_msg->from));
   1.119 +        else
   1.120 +            status = myself(session, tmp_msg->from);
   1.121 +
   1.122          if (status == PEP_ILLEGAL_VALUE || status == PEP_OUT_OF_MEMORY)
   1.123              GOTO(pep_error);
   1.124      }
   1.125  
   1.126 -    // Own identities can be retrieved here where they would otherwise
   1.127 -    // fail because we lack all other information. This is ok and even
   1.128 -    // desired. FIXME: IS it?
   1.129      status = update_identity_recip_list(session, tmp_msg->to);
   1.130      if (status != PEP_STATUS_OK)
   1.131          GOTO(pep_error);
   1.132 @@ -3514,7 +3546,11 @@
   1.133      }
   1.134  got_keylist:
   1.135  
   1.136 -    status = update_identity(session, msg->from);
   1.137 +    if (!is_me(session, msg->from))
   1.138 +        status = update_identity(session, msg->from);
   1.139 +    else
   1.140 +        status = myself(session, msg->from);
   1.141 +
   1.142      if (status != PEP_STATUS_OK)
   1.143          GOTO(pep_error);
   1.144