summaryrefslogtreecommitdiff
path: root/message_notify/messagenotify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'message_notify/messagenotify.cpp')
-rw-r--r--message_notify/messagenotify.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/message_notify/messagenotify.cpp b/message_notify/messagenotify.cpp
index f5de3e3..fe37a28 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,0,1),
+ PLUGIN_MAKE_VERSION(0,2,0,3),
"Show a popup when a message is received",
"Scott Ellis",
"mail@scottellis.com.au",
@@ -197,21 +197,23 @@ unsigned int __stdcall sttCheckWindowProc( VOID *dwParam ) {
}
}
- wchar_t *msg;
- int msglen = strlen((char *)cd->blob) + 1;
+ wchar_t *msg = 0;
// does blob contain unicode message?
- if(msglen != cd->blobsize && wcslen((wchar_t *)(&cd->blob[msglen]))) {
- // yes
- msg = (wchar_t *)(&cd->blob[msglen]);
- ShowPopupW(cd->hContact, swzContactDisplayName, msg);
- } else if(cd->blobsize) {
- // no, convert to unciode
- int size = MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, 0, 0);
- msg = (wchar_t *) malloc(sizeof(wchar_t) * size);
- MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, msg, size);
- ShowPopupW(cd->hContact, swzContactDisplayName, msg);
- free(msg);
+ if(cd->blobsize) {
+ int msglen = strlen((char *)cd->blob) + 1;
+ if(msglen != cd->blobsize && wcslen((wchar_t *)(&cd->blob[msglen]))) {
+ // yes
+ msg = (wchar_t *)(&cd->blob[msglen]);
+ ShowPopupW(cd->hContact, swzContactDisplayName, msg);
+ } else {
+ // no, convert to unciode
+ int size = MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, 0, 0);
+ msg = (wchar_t *) malloc(sizeof(wchar_t) * size);
+ MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, msg, size);
+ ShowPopupW(cd->hContact, swzContactDisplayName, msg);
+ free(msg);
+ }
} else { // no message
ShowPopupW(cd->hContact, swzContactDisplayName, 0);
}