From cfc3f883b893fab0042738d1ed228467d5a7ac74 Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 19 Jun 2007 12:09:16 +0000 Subject: added support for utf8 git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@206 4f64403b-2f21-0410-a795-97e2b3489a10 --- message_notify/messagenotify.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'message_notify/messagenotify.cpp') diff --git a/message_notify/messagenotify.cpp b/message_notify/messagenotify.cpp index 1e7628a..437b614 100644 --- a/message_notify/messagenotify.cpp +++ b/message_notify/messagenotify.cpp @@ -27,7 +27,7 @@ DWORD focusTimerId = 0; PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), "Message Notify", - PLUGIN_MAKE_VERSION(0,2,1,0), + PLUGIN_MAKE_VERSION(0,2,2,0), "Show a popup when a message is received", "Scott Ellis", "mail@scottellis.com.au", @@ -162,6 +162,7 @@ typedef struct { HANDLE hContact; BYTE *blob; int blobsize; + int flags; HANDLE hEvent; } CheckWindowData; @@ -203,7 +204,10 @@ unsigned int __stdcall sttCheckWindowProc( VOID *dwParam ) { } else { // no, convert to unciode wchar_t msg[MAX_SECONDLINE]; - MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, msg, MAX_SECONDLINE); + if(cd->flags & DBEF_UTF) + MultiByteToWideChar(CP_UTF8, 0, (char *) cd->blob, -1, msg, MAX_SECONDLINE); + else + MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, msg, MAX_SECONDLINE); ShowPopupW(cd->hContact, swzContactDisplayName, msg); } } else { @@ -262,6 +266,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { // copy blob data cd->blobsize = dbei->cbBlob; cd->blob = new BYTE[cd->blobsize]; + cd->flags = dbei->flags; memcpy(cd->blob, dbei->pBlob, cd->blobsize); } else cd->blobsize = 0; @@ -331,12 +336,14 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { metacontacts_installed = (ServiceExists(MS_MC_GETMETACONTACT) != 0); + hEventDbEventAdded = HookEvent(ME_DB_EVENT_FILTER_ADD, OnDatabaseEventPreAdd); hIdle = HookEvent(ME_IDLE_CHANGED, OnIdleChanged); hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); if(options.notify_when == NOTIFY_NFORE) StartFocusTimer(); + return 0; } @@ -387,8 +394,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) popupWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); - hEventDbEventAdded = HookEvent(ME_DB_EVENT_FILTER_ADD, OnDatabaseEventPreAdd); - return 0; } -- cgit v1.2.3