summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-28 20:01:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-28 20:01:17 +0000
commit25c539d764f65bbb5981fd4d9d169b36ded5ba16 (patch)
tree3207ad72661cbe0ed28504cc517bea9edab2ad41 /plugins
parent41caa325f5315822f50a225d9c14de2174ca5f30 (diff)
hooks removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@4230 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ClientChangeNotify/src/ClientChangeNotify.cpp31
1 files changed, 9 insertions, 22 deletions
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<HANDLE> 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;
}