From 6b6e144b140f8f3ce2fa6b1de7e6a13d92030caf Mon Sep 17 00:00:00 2001 From: Szymon Tokarz Date: Tue, 21 May 2013 16:41:00 +0000 Subject: LotusNotify plugin by MaKaRSoFT adapted by me. plugin from: http://maciej.wycik.pl/p_lotusnotify.php base sources from: https://code.google.com/p/makarplugins/ - Miranda NG version - unicode support - many fixes and code reworks git-svn-id: http://svn.miranda-ng.org/main/trunk@4780 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/LotusNotify/src/debug.cpp | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 plugins/LotusNotify/src/debug.cpp (limited to 'plugins/LotusNotify/src/debug.cpp') diff --git a/plugins/LotusNotify/src/debug.cpp b/plugins/LotusNotify/src/debug.cpp new file mode 100644 index 0000000000..e27f291817 --- /dev/null +++ b/plugins/LotusNotify/src/debug.cpp @@ -0,0 +1,57 @@ +#include "stdafx.h" +#include "debug.h" + +HANDLE netlibHandle; + + +void logRegister(){ + + // Register netlib user for logging function + NETLIBUSER nlu = { 0 }; + nlu.cbSize = sizeof(nlu); + nlu.flags = NUF_TCHAR | NUF_NOOPTIONS; + nlu.szSettingsModule = PLUGINNAME; + nlu.ptszDescriptiveName = mir_a2u(PLUGINNAME); + netlibHandle = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + +} + +void logUnregister(){ + + Netlib_CloseHandle(netlibHandle); + netlibHandle = NULL; + +} + +void log(const wchar_t* szText){ + + if (netlibHandle) { + CallService(MS_NETLIB_LOGW, (WPARAM)netlibHandle, (LPARAM)szText); + } + + #ifdef _DEBUG + OutputDebugString(szText); + #endif //_DEBUG + +} + +void log_p(const wchar_t* szText, ...){ + + va_list args; + va_start(args, szText); + int len = _vscwprintf(szText, args ) + 1; // _vscprintf doesn't count terminating '\0' + wchar_t* buffer = new wchar_t[len * sizeof(wchar_t)]; + vswprintf_s(buffer, len, szText, args); + va_end(args); + log(buffer); + delete buffer; + +} + + + + + + + + -- cgit v1.2.3