Browse Source

adding blacklist

COM-121
Volker Birk 6 years ago
parent
commit
e29e81a8ae
4 changed files with 72 additions and 0 deletions
  1. +57
    -0
      CpEpEngine.cpp
  2. +7
    -0
      CpEpEngine.h
  3. +7
    -0
      pEpCOMServerAdapter.idl
  4. +1
    -0
      stdafx.h

+ 57
- 0
CpEpEngine.cpp View File

@ -961,6 +961,63 @@ int CpEpEngine::examine_identity(pEp_identity *ident, void *management)
return _ident;
}
STDMETHODIMP CpEpEngine::blacklist_add(BSTR fpr)
{
assert(fpr);
string _fpr = utf8_string(fpr);
PEP_STATUS status = ::blacklist_add(get_session(), _fpr.c_str());
assert(status == PEP_STATUS_OK);
if (status != PEP_STATUS_OK)
return FAIL(L"blacklist_add failed in pEp engine");
return S_OK;
}
STDMETHODIMP CpEpEngine::blacklist_delete(BSTR fpr)
{
assert(fpr);
string _fpr = utf8_string(fpr);
PEP_STATUS status = ::blacklist_delete(get_session(), _fpr.c_str());
assert(status == PEP_STATUS_OK);
if (status != PEP_STATUS_OK)
return FAIL(L"blacklist_delete failed in pEp engine");
return S_OK;
}
STDMETHODIMP CpEpEngine::blacklist_is_listed(BSTR fpr, VARIANT_BOOL *listed)
{
assert(fpr);
assert(listed);
string _fpr = utf8_string(fpr);
bool result;
PEP_STATUS status = ::blacklist_is_listed(get_session(), _fpr.c_str(), &result);
assert(status == PEP_STATUS_OK);
if (status != PEP_STATUS_OK)
return FAIL(L"blacklist_is_listed failed in pEp engine");
*listed = result ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CpEpEngine::blacklist_retrieve(SAFEARRAY **blacklist)
{
assert(blacklist);
::stringlist_t *_blacklist = NULL;
PEP_STATUS status = ::blacklist_retrieve(get_session(), &_blacklist);
assert(status == PEP_STATUS_OK);
if (status != PEP_STATUS_OK)
return FAIL(L"blacklist_retrieve failed in pEp engine");
assert(_blacklist);
*blacklist = string_array(_blacklist);
return S_OK;
}
HRESULT CpEpEngine::error(_bstr_t msg)
{
_bstr_t helpFile = L"";


+ 7
- 0
CpEpEngine.h View File

@ -171,6 +171,13 @@ public:
STDMETHOD(key_reset_trust)(struct pEp_identity_s *ident);
STDMETHOD(trust_personal_key)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
// Blacklist API
STDMETHOD(blacklist_add)(BSTR fpr);
STDMETHOD(blacklist_delete)(BSTR fpr);
STDMETHOD(blacklist_is_listed)(BSTR fpr, VARIANT_BOOL *listed);
STDMETHOD(blacklist_retrieve)(SAFEARRAY **blacklist);
// Message API
STDMETHOD(encrypt_message)(text_message * src, text_message * dst, SAFEARRAY * extra);


+ 7
- 0
pEpCOMServerAdapter.idl View File

@ -177,6 +177,13 @@ interface IpEpEngine : IUnknown {
HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
// Blacklist API
HRESULT blacklist_add([in] BSTR fpr);
HRESULT blacklist_delete([in] BSTR fpr);
HRESULT blacklist_is_listed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
HRESULT blacklist_retrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
// Message API
typedef enum _pEp_color {


+ 1
- 0
stdafx.h View File

@ -42,3 +42,4 @@
#include "../../pEpEngine/src/keymanagement.h"
#include "../../pEpEngine/src/message_api.h"
#include "../../pEpEngine/src/stringpair.h"
#include "../../pEpEngine/src/blacklist.h"

Loading…
Cancel
Save