From 82c9e950fca702c8c9ae0074c90b81fe054d49df Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 13 Apr 2013 16:24:46 +0000 Subject: fixed playsound hooking git-svn-id: http://svn.miranda-ng.org/main/trunk@4438 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/XSoundNotify/src/xsn_main.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'plugins/XSoundNotify/src') 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_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; } -- cgit v1.2.3