From 9de0202a0b12838d505825413c3cbcce5edabc11 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Mar 2013 22:12:20 +0000 Subject: cleanup of the unnecessary UnhookEvent() calls git-svn-id: http://svn.miranda-ng.org/main/trunk@3909 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ContactsPlus/src/main.cpp | 51 +++++++++++++-------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) (limited to 'plugins/ContactsPlus') diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 84c42bca68..1bac904867 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -34,15 +34,6 @@ HANDLE ghSendWindowList; HANDLE ghRecvWindowList; gAckList gaAckData; -HANDLE hServiceSend; -HANDLE hServiceReceive; - -HANDLE hHookModulesLoaded = NULL; -HANDLE hHookDBEventAdded = NULL; -HANDLE hHookContactDeleted = NULL; -HANDLE hHookContactSettingChanged = NULL; -HANDLE hHookPreBuildContactMenu = NULL; - HANDLE hContactMenuItem = NULL; PLUGININFOEX pluginInfo = { @@ -179,7 +170,7 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS)); hContactMenuItem = Menu_AddContactMenuItem(&mi); - hHookPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, HookPreBuildContactMenu); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, HookPreBuildContactMenu); ghSendWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this ghRecvWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); // no need to destroy this @@ -251,33 +242,25 @@ extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); InitCommonControls(); - InitI18N(); - - //init hooks - hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, HookModulesLoaded); - hHookDBEventAdded = HookEvent(ME_DB_EVENT_ADDED, HookDBEventAdded); - hHookContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, HookContactDeleted); - hHookContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, HookContactSettingChanged); - //create services - hServiceSend = CreateServiceFunction(MS_CONTACTS_SEND, ServiceSendCommand); - hServiceReceive = CreateServiceFunction(MS_CONTACTS_RECEIVE, ServiceReceiveCommand); - //define event sounds - SkinAddNewSound("RecvContacts", LPGEN("Incoming Contacts"), "contacts.wav"); - SkinAddNewSound("SentContacts", LPGEN("Outgoing Contacts"), "ocontacts.wav"); + InitI18N(); - return 0; + //init hooks + HookEvent(ME_SYSTEM_MODULESLOADED, HookModulesLoaded); + HookEvent(ME_DB_EVENT_ADDED, HookDBEventAdded); + HookEvent(ME_DB_CONTACT_DELETED, HookContactDeleted); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, HookContactSettingChanged); + + //create services + CreateServiceFunction(MS_CONTACTS_SEND, ServiceSendCommand); + CreateServiceFunction(MS_CONTACTS_RECEIVE, ServiceReceiveCommand); + + //define event sounds + SkinAddNewSound("RecvContacts", LPGEN("Incoming Contacts"), "contacts.wav"); + SkinAddNewSound("SentContacts", LPGEN("Outgoing Contacts"), "ocontacts.wav"); + return 0; } extern "C" __declspec(dllexport) int Unload(void) { - UnhookEvent(hHookModulesLoaded); - UnhookEvent(hHookDBEventAdded); - UnhookEvent(hHookContactDeleted); - UnhookEvent(hHookContactSettingChanged); - UnhookEvent(hHookPreBuildContactMenu); - - DestroyServiceFunction(hServiceSend); - DestroyServiceFunction(hServiceReceive); - - return 0; + return 0; } -- cgit v1.2.3