diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-11 13:26:01 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2006-11-11 13:26:01 +0000 |
commit | 4e1b05db0379ee0bb6bdd146e575b6bdd5e42cf5 (patch) | |
tree | 8ec2a05bfd0ab75ec10e28496c636c1db05abf0c /message_notify/messagenotify.cpp | |
parent | d28d7257050561d9f9f9a39b4c2ddb233ac1ffaa (diff) |
added option to enable/disable message text in popup, made options page a little bigger
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@40 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'message_notify/messagenotify.cpp')
-rw-r--r-- | message_notify/messagenotify.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/message_notify/messagenotify.cpp b/message_notify/messagenotify.cpp index 69595b2..ccf1b47 100644 --- a/message_notify/messagenotify.cpp +++ b/message_notify/messagenotify.cpp @@ -26,7 +26,7 @@ DWORD focusTimerId = 0; PLUGININFO pluginInfo={
sizeof(PLUGININFO),
"Message Notify",
- PLUGIN_MAKE_VERSION(0,1,1,1),
+ PLUGIN_MAKE_VERSION(0,1,2,0),
"Show a popup when a message is received",
"Scott Ellis",
"mail@scottellis.com.au",
@@ -195,15 +195,20 @@ unsigned int __stdcall sttCheckWindowProc( VOID *dwParam ) { 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);
}
if(!unicode_system) free(swzContactDisplayName);
} else {
char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)cd->hContact, 0);
if(szCDN && szCDN[0]) {
- char msg[MAX_SECONDLINE];
- strncpy(msg, (char *)cd->blob, MAX_SECONDLINE - 1);
- msg[MAX_SECONDLINE - 1] = 0;
- ShowPopup(cd->hContact, szCDN, (char *)msg);
+ if(cd->blobsize) {
+ char msg[MAX_SECONDLINE];
+ strncpy(msg, (char *)cd->blob, MAX_SECONDLINE - 1);
+ msg[MAX_SECONDLINE - 1] = 0;
+ ShowPopup(cd->hContact, szCDN, (char *)msg);
+ } else
+ ShowPopup(cd->hContact, szCDN, 0);
}
}
}
@@ -239,12 +244,15 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { return 0; // just to be safe
- // copy blob data
CheckWindowData *cd = new CheckWindowData;
cd->hContact = (HANDLE)wParam;
- cd->blobsize = dbei->cbBlob;
- cd->blob = new BYTE[cd->blobsize];
- memcpy(cd->blob, dbei->pBlob, cd->blobsize);
+ if(options.show_msg) {
+ // copy blob data
+ cd->blobsize = dbei->cbBlob;
+ cd->blob = new BYTE[cd->blobsize];
+ memcpy(cd->blob, dbei->pBlob, cd->blobsize);
+ } else
+ cd->blobsize = 0;
// spawn a thread to deal with the copied data
CloseHandle((HANDLE)_beginthreadex(0, 0, sttCheckWindowProc, (VOID *)cd, 0, 0));
|