adding blacklist
authorVolker Birk <vb@pep-project.org>
Fri, 11 Mar 2016 16:07:00 +0100
changeset 654736900394cb
parent 62 e01f81c9c881
child 66 b27aa367761c
adding blacklist
CpEpEngine.cpp
CpEpEngine.h
pEpCOMServerAdapter.idl
stdafx.h
     1.1 --- a/CpEpEngine.cpp	Mon Mar 07 15:28:09 2016 +0100
     1.2 +++ b/CpEpEngine.cpp	Fri Mar 11 16:07:00 2016 +0100
     1.3 @@ -961,6 +961,63 @@
     1.4      return _ident;
     1.5  }
     1.6  
     1.7 +STDMETHODIMP CpEpEngine::blacklist_add(BSTR fpr)
     1.8 +{
     1.9 +    assert(fpr);
    1.10 +
    1.11 +    string _fpr = utf8_string(fpr);
    1.12 +    PEP_STATUS status = ::blacklist_add(get_session(), _fpr.c_str());
    1.13 +    assert(status == PEP_STATUS_OK);
    1.14 +    if (status != PEP_STATUS_OK)
    1.15 +        return FAIL(L"blacklist_add failed in pEp engine");
    1.16 +
    1.17 +    return S_OK;
    1.18 +}
    1.19 +
    1.20 +STDMETHODIMP CpEpEngine::blacklist_delete(BSTR fpr)
    1.21 +{
    1.22 +    assert(fpr);
    1.23 +
    1.24 +    string _fpr = utf8_string(fpr);
    1.25 +    PEP_STATUS status = ::blacklist_delete(get_session(), _fpr.c_str());
    1.26 +    assert(status == PEP_STATUS_OK);
    1.27 +    if (status != PEP_STATUS_OK)
    1.28 +        return FAIL(L"blacklist_delete failed in pEp engine");
    1.29 +
    1.30 +    return S_OK;
    1.31 +}
    1.32 +
    1.33 +STDMETHODIMP CpEpEngine::blacklist_is_listed(BSTR fpr, VARIANT_BOOL *listed)
    1.34 +{
    1.35 +    assert(fpr);
    1.36 +    assert(listed);
    1.37 +
    1.38 +    string _fpr = utf8_string(fpr);
    1.39 +    bool result;
    1.40 +    PEP_STATUS status = ::blacklist_is_listed(get_session(), _fpr.c_str(), &result);
    1.41 +    assert(status == PEP_STATUS_OK);
    1.42 +    if (status != PEP_STATUS_OK)
    1.43 +        return FAIL(L"blacklist_is_listed failed in pEp engine");
    1.44 +
    1.45 +    *listed = result ? VARIANT_TRUE : VARIANT_FALSE;
    1.46 +    return S_OK;
    1.47 +}
    1.48 +
    1.49 +STDMETHODIMP CpEpEngine::blacklist_retrieve(SAFEARRAY **blacklist)
    1.50 +{
    1.51 +    assert(blacklist);
    1.52 +
    1.53 +    ::stringlist_t *_blacklist = NULL;
    1.54 +    PEP_STATUS status = ::blacklist_retrieve(get_session(), &_blacklist);
    1.55 +    assert(status == PEP_STATUS_OK);
    1.56 +    if (status != PEP_STATUS_OK)
    1.57 +        return FAIL(L"blacklist_retrieve failed in pEp engine");
    1.58 +    assert(_blacklist);
    1.59 +
    1.60 +    *blacklist = string_array(_blacklist);
    1.61 +    return S_OK;
    1.62 +}
    1.63 +
    1.64  HRESULT CpEpEngine::error(_bstr_t msg)
    1.65  {
    1.66      _bstr_t helpFile = L"";
     2.1 --- a/CpEpEngine.h	Mon Mar 07 15:28:09 2016 +0100
     2.2 +++ b/CpEpEngine.h	Fri Mar 11 16:07:00 2016 +0100
     2.3 @@ -171,6 +171,13 @@
     2.4      STDMETHOD(key_reset_trust)(struct pEp_identity_s *ident);
     2.5      STDMETHOD(trust_personal_key)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
     2.6  
     2.7 +    // Blacklist API
     2.8 +
     2.9 +    STDMETHOD(blacklist_add)(BSTR fpr);
    2.10 +    STDMETHOD(blacklist_delete)(BSTR fpr);
    2.11 +    STDMETHOD(blacklist_is_listed)(BSTR fpr, VARIANT_BOOL *listed);
    2.12 +    STDMETHOD(blacklist_retrieve)(SAFEARRAY **blacklist);
    2.13 +
    2.14      // Message API
    2.15  
    2.16      STDMETHOD(encrypt_message)(text_message * src, text_message * dst, SAFEARRAY * extra);
     3.1 --- a/pEpCOMServerAdapter.idl	Mon Mar 07 15:28:09 2016 +0100
     3.2 +++ b/pEpCOMServerAdapter.idl	Fri Mar 11 16:07:00 2016 +0100
     3.3 @@ -177,6 +177,13 @@
     3.4      HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
     3.5      HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
     3.6  
     3.7 +    // Blacklist API
     3.8 +
     3.9 +    HRESULT blacklist_add([in] BSTR fpr);
    3.10 +    HRESULT blacklist_delete([in] BSTR fpr);
    3.11 +    HRESULT blacklist_is_listed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
    3.12 +    HRESULT blacklist_retrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
    3.13 +
    3.14      // Message API
    3.15  
    3.16      typedef enum _pEp_color {
     4.1 --- a/stdafx.h	Mon Mar 07 15:28:09 2016 +0100
     4.2 +++ b/stdafx.h	Fri Mar 11 16:07:00 2016 +0100
     4.3 @@ -42,3 +42,4 @@
     4.4  #include "../../pEpEngine/src/keymanagement.h"
     4.5  #include "../../pEpEngine/src/message_api.h"
     4.6  #include "../../pEpEngine/src/stringpair.h"
     4.7 +#include "../../pEpEngine/src/blacklist.h"