From 627583b9c2b73eee5d692169a2e0d0c59535c525 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sat, 26 Oct 2013 21:12:00 +0000 Subject: popup disabling fix (by person) git-svn-id: http://svn.miranda-ng.org/main/trunk@6640 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StartupSilence/src/main.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'plugins/StartupSilence') diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 176fa9a1bf..7587fc1bda 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -31,10 +31,12 @@ HANDLE GetIconHandle(char *szIcon); HANDLE hOptionsInitialize; HANDLE hTTBarloaded = NULL; HANDLE Buttons = NULL; +HANDLE hPopups = NULL; static HANDLE hSturtupSilenceEnabled; INT_PTR CALLBACK DlgProcOptions(HWND, UINT, WPARAM, LPARAM); int InitializeOptions(WPARAM wParam,LPARAM lParam); +int DisablePopup(WPARAM wParam, LPARAM lParam); static int CreateTTButtons(WPARAM wParam, LPARAM lParam); void RemoveTTButtons(); BYTE Enabled; @@ -43,6 +45,7 @@ BYTE PopUp; DWORD PopUpTime; BYTE MenuItem; BYTE TTBButtons; +BYTE timer; char hostname[MAX_PATH] = ""; char EnabledComp[MAX_PATH] = ""; char DelayComp[MAX_PATH] = ""; @@ -80,6 +83,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda INT_PTR StartupSilence() { InitSettings(); + hPopups = HookEvent(ME_POPUP_FILTER, DisablePopup); mir_forkthread((pThreadFunc)AdvSt, NULL); hSturtupSilenceEnabled = CreateServiceFunction(SS_SERVICE_NAME, SturtupSilenceEnabled); IsMenu(); @@ -101,10 +105,18 @@ extern "C" __declspec(dllexport) int Unload(void) if (hTTBarloaded != NULL){ UnhookEvent(ME_TTB_MODULELOADED); } + UnhookEvent(hPopups); DestroyServiceFunction(hSturtupSilenceEnabled); return 0; } +int DisablePopup(WPARAM wParam, LPARAM lParam) +{ + if (timer == 2) + return 1; + return 0; +} + void InitSettings() { if(gethostname(hostname, SIZEOF(hostname)) == 0){ @@ -188,17 +200,10 @@ static INT_PTR AdvSt() wcsncpy_s(ppd.lptzContactName, lptzText, size_t(lptzText)); PUAddPopupT(&ppd); } - if (ServiceExists(POPUPONOFF)) - db_set_b(NULL, "YAPP", "Enabled", 0); - if (ServiceExists(POPUPONOFFPP)) - db_set_b(NULL, "PopUp", "ModuleIsEnabled", 0); + timer = 2; Sleep(delay * 1000); - - if (ServiceExists(POPUPONOFF)) - db_set_b(NULL, "YAPP", "Enabled", 1); - if (ServiceExists(POPUPONOFFPP)) - db_set_b(NULL, "PopUp", "ModuleIsEnabled", 1); + timer = 0; db_set_b(NULL, "Skin", "UseSound", 1); if (PopUp == 1) { -- cgit v1.2.3