From 25c539d764f65bbb5981fd4d9d169b36ded5ba16 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 Mar 2013 20:01:17 +0000 Subject: hooks removed git-svn-id: http://svn.miranda-ng.org/main/trunk@4230 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 31 +++++++--------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'plugins/ClientChangeNotify/src') diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 1789e48742..b57836ab78 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -23,7 +23,7 @@ HINSTANCE g_hInstance; HANDLE g_hMainThread; HANDLE g_hTogglePopupsMenuItem; int hLangpack; -TMyArray hHooks, hServices; + COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview) BOOL bPopupExists = FALSE, bMetaContactsExists = FALSE, bFingerprintExists = FALSE, bVariablesExists = FALSE; @@ -325,14 +325,12 @@ static int ContactSettingsInit(WPARAM wParam, LPARAM lParam) return 0; } - static INT_PTR srvTogglePopups(WPARAM wParam, LPARAM lParam) { g_PopupOptPage.SetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY, !g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)); return 0; } - static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam) { // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded @@ -389,17 +387,16 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) COptPage PopupOptPage(g_PopupOptPage); PopupOptPage.DBToMem(); RecompileRegexps(*(TCString*)PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS)); - hHooks.AddElem(HookEvent(ME_OPT_INITIALISE, OptionsDlgInit)); - hHooks.AddElem(HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad)); - hHooks.AddElem(HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad)); - hHooks.AddElem(HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged)); - hHooks.AddElem(HookEvent(ME_CONTACTSETTINGS_INITIALISE, ContactSettingsInit)); + HookEvent(ME_OPT_INITIALISE, OptionsDlgInit); + HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); + HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); + HookEvent(ME_CONTACTSETTINGS_INITIALISE, ContactSettingsInit); SkinAddNewSoundEx(CLIENTCHANGED_SOUND, NULL, LPGEN("ClientChangeNotify: Client changed")); - if (bPopupExists) { - hServices.AddElem(CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups)); - hHooks.AddElem(HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu)); + CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups); + HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu); CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR; @@ -421,12 +418,11 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) return 0; } - extern "C" int __declspec(dllexport) Load(void) { mir_getLP( &pluginInfo ); - hHooks.AddElem(HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded)); + HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, THREAD_SET_CONTEXT, false, 0); InitOptions(); if (DBGetContactSettingString(NULL, "KnownModules", MOD_NAME, (char*)NULL) == NULL) @@ -446,15 +442,6 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload() { CloseHandle(g_hMainThread); - int I; - for (I = 0; I < hHooks.GetSize(); I++) - if (hHooks[I]) - UnhookEvent(hHooks[I]); - - for (I = 0; I < hServices.GetSize(); I++) - if (hServices[I]) - DestroyServiceFunction(hServices[I]); - UninitPcre(); return 0; } -- cgit v1.2.3