summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-11-19 23:27:48 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2007-11-19 23:27:48 +0000
commitd926369611fbf2dc975e0080cbd60cfa111c7d11 (patch)
treee63f89b30e2e066233558c2917ca85209f1f9a38
parent94d3d32ede74da67fe1637f900ad0e26507ffd34 (diff)
fix utf8 messages with non-unicode popups (thx Pescuma)
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@380 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r--message_notify/MessageNotify.mdsp12
-rw-r--r--message_notify/messagenotify.cpp19
2 files changed, 22 insertions, 9 deletions
diff --git a/message_notify/MessageNotify.mdsp b/message_notify/MessageNotify.mdsp
index 8d24e85..83d138b 100644
--- a/message_notify/MessageNotify.mdsp
+++ b/message_notify/MessageNotify.mdsp
@@ -96,11 +96,11 @@ extraResourceOptions=
[Other]
1=..\..\include\m_database.h
[History]
-collection.h,5114
-..\..\include\m_database.h,16840
-common.h,641
-options.cpp,0
-mywindowlist.cpp,0
+messagenotify.cpp,639
popups.cpp,6329
-messagenotify.cpp,662
+mywindowlist.cpp,0
+options.cpp,0
+common.h,641
+..\..\include\m_database.h,16840
+collection.h,5114
m_speak.h,6298
diff --git a/message_notify/messagenotify.cpp b/message_notify/messagenotify.cpp
index c6b4b94..4d9e319 100644
--- a/message_notify/messagenotify.cpp
+++ b/message_notify/messagenotify.cpp
@@ -16,6 +16,9 @@ Map<HANDLE, HWND> open_msg_windows;
HINSTANCE hInst;
PLUGINLINK *pluginLink;
+MM_INTERFACE mmi;
+UTF8_INTERFACE utfi;
+
HANDLE mainThread;
bool metacontacts_installed;
@@ -29,7 +32,7 @@ DWORD focusTimerId = 0;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
"Message Notify",
- PLUGIN_MAKE_VERSION(0, 4, 0, 1),
+ PLUGIN_MAKE_VERSION(0, 4, 1, 0),
"Show a popup when a message is received",
"Scott Ellis",
"mail@scottellis.com.au",
@@ -240,8 +243,15 @@ unsigned int __stdcall sttCheckWindowProc( VOID *dwParam ) {
char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)cd->hContact, 0);
if(szCDN && szCDN[0]) {
if(cd->blobsize) {
- if((options.flags & MNNF_POPUP) && options.show_msg) ShowPopup(cd->hContact, szCDN, (char *)cd->blob);
- if(options.flags & MNNF_SPEAK) Speak_SayExA("messages", cd->hContact, (char *)cd->blob);
+ if(cd->flags & DBEF_UTF) {
+ char *msg = mir_utf8decodecp((char *)cd->blob, code_page, 0);
+ if((options.flags & MNNF_POPUP) && options.show_msg) ShowPopup(cd->hContact, szCDN, (char *)msg);
+ if(options.flags & MNNF_SPEAK) Speak_SayExA("messages", cd->hContact, (char *)msg);
+ mir_free(msg);
+ } else {
+ if((options.flags & MNNF_POPUP) && options.show_msg) ShowPopup(cd->hContact, szCDN, (char *)cd->blob);
+ if(options.flags & MNNF_SPEAK) Speak_SayExA("messages", cd->hContact, (char *)cd->blob);
+ }
} else {
if(options.flags & MNNF_POPUP) ShowPopup(cd->hContact, szCDN, 0);
if(options.flags & MNNF_SPEAK) Speak_SayExA("messages", cd->hContact, "empty message");
@@ -418,6 +428,9 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
pluginLink = link;
DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 );
+ mir_getMMI(&mmi);
+ mir_getUTFI(&utfi);
+
char szVer[128];
unicode_system = (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVer), (LPARAM)szVer) == 0 && strstr(szVer, "Unicode"));