1.1 --- a/CpEpEngine.cpp Sat Oct 03 13:39:04 2015 +0200
1.2 +++ b/CpEpEngine.cpp Wed Oct 07 21:04:19 2015 +0200
1.3 @@ -3,6 +3,8 @@
1.4 #include "stdafx.h"
1.5 #include "CpEpEngine.h"
1.6
1.7 +#define VERBOSE(TEXT) if (verbose_mode) verbose(TEXT)
1.8 +
1.9 using namespace std;
1.10 using namespace pEp::utility;
1.11
1.12 @@ -25,7 +27,11 @@
1.13
1.14 #define FAIL(msg) error(msg)
1.15
1.16 -// CpEpEngine
1.17 +STDMETHODIMP CpEpEngine::verbose_logging(BOOL enable)
1.18 +{
1.19 + verbose_mode = enable != 0;
1.20 + return S_OK;
1.21 +}
1.22
1.23 STDMETHODIMP CpEpEngine::log(BSTR title, BSTR entity, BSTR description, BSTR comment)
1.24 {
2.1 --- a/CpEpEngine.h Sat Oct 03 13:39:04 2015 +0200
2.2 +++ b/CpEpEngine.h Wed Oct 07 21:04:19 2015 +0200
2.3 @@ -32,7 +32,7 @@
2.4 static int examine_identity(pEp_identity *ident, void *management);
2.5
2.6 public:
2.7 - CpEpEngine() : keymanagement_thread(NULL), identity_queue(NULL)
2.8 + CpEpEngine() : keymanagement_thread(NULL), identity_queue(NULL), verbose_mode(false)
2.9 {
2.10 PEP_STATUS status = ::init(&m_session);
2.11 assert(status == PEP_STATUS_OK);
2.12 @@ -109,13 +109,25 @@
2.13 static ::pEp_identity * retrieve_next_identity(void *management);
2.14 HRESULT error(_bstr_t msg);
2.15
2.16 + void verbose(string text)
2.17 + {
2.18 + if (verbose_mode) {
2.19 + stringstream ss;
2.20 + ss << __FILE__ << ":" << __LINE__ << " " << text;
2.21 + ::log_event(get_session(), "verbose", "pEp COM Server Adapter", ss.str().c_str(), NULL);
2.22 + }
2.23 + }
2.24 +
2.25 private:
2.26 PEP_SESSION m_session;
2.27 mutex session_mutex;
2.28 atomic< identity_queue_t * > identity_queue;
2.29 thread *keymanagement_thread;
2.30 + bool verbose_mode;
2.31
2.32 public:
2.33 + STDMETHOD(verbose_logging)(BOOL enable);
2.34 +
2.35 STDMETHOD(log)(BSTR title, BSTR entity, BSTR description, BSTR comment);
2.36 STDMETHOD(decrypt)(BSTR ctext, BSTR * ptext, LPSAFEARRAY * key_list, pEp_STATUS * decrypt_status);
2.37 STDMETHOD(decrypt_b)(BSTR ctext, LPSAFEARRAY * ptext, LPSAFEARRAY * key_list, pEp_STATUS * decrypt_status);
3.1 --- a/pEpCOMServerAdapter.idl Sat Oct 03 13:39:04 2015 +0200
3.2 +++ b/pEpCOMServerAdapter.idl Wed Oct 07 21:04:19 2015 +0200
3.3 @@ -15,6 +15,8 @@
3.4 pointer_default(unique)
3.5 ]
3.6 interface IpEpEngine : IUnknown {
3.7 + HRESULT verbose_logging([in] BOOL enable);
3.8 +
3.9 typedef enum _pEp_STATUS {
3.10 pEp_STATUS_OK = 0,
3.11