summaryrefslogtreecommitdiff
path: root/plugins/XSoundNotify
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-04-13 16:24:46 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-04-13 16:24:46 +0000
commit82c9e950fca702c8c9ae0074c90b81fe054d49df (patch)
treea4dd7c99d4ddc9596e4c7db48e0b4088d4b346c3 /plugins/XSoundNotify
parent1671ec08e6d19b72e910bc2e61dcf974a8472586 (diff)
fixed playsound hooking
git-svn-id: http://svn.miranda-ng.org/main/trunk@4438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/XSoundNotify')
-rw-r--r--plugins/XSoundNotify/src/xsn_main.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp
index 6954e8b2ef..f1e338daa3 100644
--- a/plugins/XSoundNotify/src/xsn_main.cpp
+++ b/plugins/XSoundNotify/src/xsn_main.cpp
@@ -14,6 +14,7 @@ int hLangpack;
LIST<XSN_Data> XSN_Users(10, HandleKeySortT);
HGENMENU hChangeSound = NULL;
HANDLE hChangeSoundDlgList = NULL;
+BYTE isIgnoreSound = 0, isOwnSound = 0;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -54,12 +55,26 @@ INT ProcessEvent(WPARAM wParam, LPARAM lParam)
if (!isReceiveMessage(lParam))
return 0;
+ isIgnoreSound = db_get_b((HANDLE)wParam, SETTINGSNAME, SETTINGSIGNOREKEY, 0);
DBVARIANT dbv;
- if ( !db_get_b((HANDLE)wParam, SETTINGSNAME, SETTINGSIGNOREKEY, 0) && !db_get_ts((HANDLE)wParam, SETTINGSNAME, SETTINGSKEY, &dbv)) {
- TCHAR longpath[MAX_PATH] = {0};
- PathToAbsoluteT(dbv.ptszVal, longpath);
- SkinPlaySoundFile(longpath);
+ if ( !isIgnoreSound && !db_get_ts((HANDLE)wParam, SETTINGSNAME, SETTINGSKEY, &dbv)) {
+ TCHAR PlaySoundPath[MAX_PATH] = {0};
+ PathToAbsoluteT(dbv.ptszVal, PlaySoundPath);
+ SkinPlaySoundFile(PlaySoundPath);
db_free(&dbv);
+ isOwnSound = 1;
+ }
+
+ return 0;
+}
+
+int OnPlaySound(WPARAM wParam, LPARAM lParam)
+{
+ if (isIgnoreSound)
+ return 1;
+ if (isOwnSound) {
+ isOwnSound = 0;
+ return 1;
}
return 0;
@@ -207,6 +222,7 @@ INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
HANDLE hContact = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ isIgnoreSound = 0;
if (p == NULL) {
DBVARIANT dbv;
if ( !db_get_ts(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
@@ -432,6 +448,7 @@ INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, L
{
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ isIgnoreSound = 0;
if (p == NULL)
{
DBVARIANT dbv;
@@ -560,6 +577,7 @@ extern "C" int __declspec(dllexport) Load()
HookEvent(ME_SYSTEM_MODULESLOADED, OnLoadInit);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
+ HookEvent(ME_SKIN_PLAYINGSOUND, OnPlaySound);
return 0;
}