Merge with ENGINE-179
authorMarkus Schaber <markus@pep-security.net>
Fri, 16 Jun 2017 23:50:21 +0200
changeset 255612df53e077a
parent 248 e55fc51ec0f9
parent 254 70e5127cfb62
child 257 9300cce7cf7b
Merge with ENGINE-179
     1.1 --- a/CpEpEngine.cpp	Fri Apr 21 17:11:50 2017 +0200
     1.2 +++ b/CpEpEngine.cpp	Fri Jun 16 23:50:21 2017 +0200
     1.3 @@ -863,18 +863,18 @@
     1.4  }
     1.5  
     1.6  
     1.7 -STDMETHODIMP CpEpEngine::EncryptMessageForSelf(pEpIdentity * target_id, TextMessage * src, TextMessage * dst, pEpEncryptFlags flags)
     1.8 +STDMETHODIMP CpEpEngine::EncryptMessageForSelf(pEpIdentity * targetId, TextMessage * src, TextMessage * dst, pEpEncryptFlags flags)
     1.9  {
    1.10 -    assert(target_id);
    1.11 +    assert(targetId);
    1.12      assert(src);
    1.13      assert(dst);
    1.14  
    1.15 -    if (!(target_id && src && dst))
    1.16 +    if (!(targetId && src && dst))
    1.17          return E_INVALIDARG;
    1.18  
    1.19      PEP_encrypt_flags_t engineFlags = (PEP_encrypt_flags_t)flags;
    1.20  
    1.21 -    ::pEp_identity *_target_id = new_identity(target_id);
    1.22 +    ::pEp_identity *_target_id = new_identity(targetId);
    1.23  
    1.24      ::message *_src = text_message_to_C(src);
    1.25  
    1.26 @@ -944,6 +944,32 @@
    1.27      return S_OK;
    1.28  }
    1.29  
    1.30 +STDMETHODIMP CpEpEngine::ReEvaluateMessageRating(TextMessage * msg, SAFEARRAY * x_KeyList, pEpRating x_EncStatus, pEpRating *rating)
    1.31 +{
    1.32 +    assert(msg);
    1.33 +    assert(x_KeyList);
    1.34 +    assert(x_EncStatus != PEP_rating_undefined);
    1.35 +    assert(rating);
    1.36 +
    1.37 +    if (!(msg && x_KeyList && x_EncStatus != PEP_rating_undefined && rating))
    1.38 +        return E_INVALIDARG;
    1.39 +
    1.40 +    *rating = pEpRatingUndefined;
    1.41 +
    1.42 +    ::message *_msg = text_message_to_C(msg);
    1.43 +    ::stringlist_t *_keylist = new_stringlist(x_KeyList);
    1.44 +    ::PEP_rating _rating = PEP_rating_undefined;
    1.45 +
    1.46 +    PEP_STATUS status = ::re_evaluate_message_rating(get_session(), _msg, _keylist, (PEP_rating)x_EncStatus, &_rating);
    1.47 +
    1.48 +    ::free_stringlist(_keylist);
    1.49 +    ::free_message(_msg);
    1.50 +
    1.51 +    *rating = (pEpRating)_rating;
    1.52 +
    1.53 +    return S_OK;
    1.54 +}
    1.55 +
    1.56  STDMETHODIMP CpEpEngine::OutgoingMessageRating(TextMessage *msg, pEpRating * pVal)
    1.57  {
    1.58      assert(msg);
    1.59 @@ -1009,13 +1035,13 @@
    1.60      return S_OK;
    1.61  }
    1.62  
    1.63 -STDMETHODIMP CpEpEngine::OwnIdentitiesRetrieve(LPSAFEARRAY* own_identities)
    1.64 +STDMETHODIMP CpEpEngine::OwnIdentitiesRetrieve(LPSAFEARRAY* ownIdentities)
    1.65  {
    1.66 -    assert(own_identities);
    1.67 -    if (!own_identities)
    1.68 +    assert(ownIdentities);
    1.69 +    if (!ownIdentities)
    1.70          return E_INVALIDARG;
    1.71  
    1.72 -    *own_identities = nullptr;
    1.73 +    *ownIdentities = nullptr;
    1.74  
    1.75      ::identity_list *il = nullptr;
    1.76      PEP_STATUS status = ::own_identities_retrieve(get_session(), &il);
    1.77 @@ -1045,7 +1071,7 @@
    1.78      }
    1.79      free_identity_list(il);
    1.80  
    1.81 -    *own_identities = _own_identities;
    1.82 +    *ownIdentities = _own_identities;
    1.83      return S_OK;
    1.84  }
    1.85  
     2.1 --- a/CpEpEngine.h	Fri Apr 21 17:11:50 2017 +0200
     2.2 +++ b/CpEpEngine.h	Fri Jun 16 23:50:21 2017 +0200
     2.3 @@ -197,7 +197,7 @@
     2.4      STDMETHOD(KeyMistrusted)(struct pEpIdentity *ident);
     2.5      STDMETHOD(KeyResetTrust)(struct pEpIdentity *ident);
     2.6      STDMETHOD(TrustPersonalKey)(struct pEpIdentity *ident, struct pEpIdentity *result);
     2.7 -	STDMETHOD(OwnIdentitiesRetrieve)(LPSAFEARRAY* own_identities);
     2.8 +	STDMETHOD(OwnIdentitiesRetrieve)(LPSAFEARRAY* ownIdentities);
     2.9  
    2.10      // Blacklist API
    2.11  
    2.12 @@ -210,12 +210,13 @@
    2.13  
    2.14      STDMETHOD(EncryptMessage)(TextMessage * src, TextMessage * dst, SAFEARRAY * extra, pEpEncryptFlags flags);
    2.15      STDMETHOD(DecryptMessage)(TextMessage * src, TextMessage * dst, SAFEARRAY ** keylist, pEpDecryptFlags* flags, pEpRating *rating);
    2.16 +    STDMETHOD(ReEvaluateMessageRating)(TextMessage * msg, SAFEARRAY * x_KeyList, pEpRating x_EncStatus, pEpRating *rating);
    2.17      STDMETHOD(OutgoingMessageRating)(TextMessage *msg, pEpRating * pVal);
    2.18      STDMETHOD(IdentityRating)(pEpIdentity * ident, pEpRating * pVal);
    2.19  	STDMETHOD(ColorFromRating)(pEpRating rating, pEpColor * pVal);
    2.20  
    2.21      STDMETHOD(EncryptMessageForSelf)(
    2.22 -        pEpIdentity * target_id, 
    2.23 +        pEpIdentity * targetId, 
    2.24          TextMessage* src,
    2.25          TextMessage *dst,
    2.26          pEpEncryptFlags flags
    2.27 @@ -232,12 +233,6 @@
    2.28  protected:
    2.29  	HRESULT Fire_MessageToSend(
    2.30  		/* [in] */ struct TextMessage *msg);
    2.31 -
    2.32 -	HRESULT Fire_NotifyHandshake(
    2.33 -		/* [in] */ struct pEpIdentity *self,
    2.34 -		/* [in] */ struct pEpIdentity *partner,
    2.35 -		/* [in] */ SyncHandshakeSignal signal,
    2.36 -		/* [retval][out] */ SyncHandshakeResult *result);
    2.37  };
    2.38  
    2.39  OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine)
     3.1 --- a/pEpCOMServerAdapter.idl	Fri Apr 21 17:11:50 2017 +0200
     3.2 +++ b/pEpCOMServerAdapter.idl	Fri Jun 16 23:50:21 2017 +0200
     3.3 @@ -176,7 +176,7 @@
     3.4      HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
     3.5      HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
     3.6      HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
     3.7 -    HRESULT OwnIdentitiesRetrieve([out, retval] SAFEARRAY(struct pEpIdentity)* own_identities);
     3.8 +    HRESULT OwnIdentitiesRetrieve([out, retval] SAFEARRAY(struct pEpIdentity)* ownIdentities);
     3.9  
    3.10      // Blacklist API
    3.11  
    3.12 @@ -314,11 +314,18 @@
    3.13      );
    3.14  
    3.15      HRESULT EncryptMessageForSelf(
    3.16 -        [in] struct pEpIdentity* target_id,
    3.17 +        [in] struct pEpIdentity* targetId,
    3.18          [in] struct TextMessage* src, 
    3.19          [out] struct TextMessage* dst,
    3.20          [in, defaultvalue(pEpEncryptFlagDefault)] pEpEncryptFlags flags
    3.21      );
    3.22 +
    3.23 +    HRESULT ReEvaluateMessageRating(
    3.24 +        [in] struct TextMessage *src,
    3.25 +        [in] SAFEARRAY(BSTR) x_KeyList, // referring to X-KeyList mail header
    3.26 +        [in] pEpRating x_EncStatus, // referring to X-EncStatus mail header
    3.27 +        [out, retval] pEpRating *rating
    3.28 +    );
    3.29  };
    3.30  
    3.31  [