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/AVS/src/main.cpp | 107 +++++++-------------- plugins/AVS/src/mir_thread.cpp | 9 +- plugins/AuthState/src/main.cpp | 34 ++----- plugins/BossKeyPlus/src/BossKey.cpp | 10 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 52 +++------- plugins/BuddyExpectator/src/options.cpp | 8 +- plugins/BuddyExpectator/src/options.h | 1 - plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp | 11 +-- plugins/Clist_nicer/src/clc.cpp | 12 +-- plugins/Clist_nicer/src/clui.cpp | 3 +- plugins/ContactsPlus/src/main.cpp | 51 ++++------ plugins/FavContacts/src/contact_cache.cpp | 3 +- plugins/FavContacts/src/contact_cache.h | 1 - plugins/FirstRun/src/main.cpp | 5 +- plugins/FlashAvatars/src/cflash.cpp | 35 +++---- plugins/FloatingContacts/src/main.cpp | 49 +++------- plugins/Folders/src/folders.cpp | 1 - plugins/Folders/src/hooked_events.cpp | 27 ++---- plugins/Folders/src/hooked_events.h | 2 - plugins/HTTPServer/src/main.cpp | 7 -- plugins/HistoryLinkListPlus/src/linklist.cpp | 14 +-- plugins/Msg_Export/src/FileViewer.cpp | 4 +- plugins/Msg_Export/src/FileViewer.h | 2 +- plugins/Msg_Export/src/main.cpp | 96 ++---------------- plugins/Scriver/src/chat/options.cpp | 8 +- plugins/TabSRMM/src/chat/options.cpp | 4 - plugins/TabSRMM/src/chat/services.cpp | 4 +- plugins/TabSRMM/src/controls.cpp | 3 +- plugins/TabSRMM/src/globals.cpp | 89 +++++------------ plugins/TabSRMM/src/include/controls.h | 2 +- plugins/TabSRMM/src/include/globals.h | 7 -- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/modplus.cpp | 19 +--- 33 files changed, 166 insertions(+), 516 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 4deb34af1c..0731748322 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -31,19 +31,11 @@ static BOOL g_MetaAvail = FALSE; BOOL g_AvatarHistoryAvail = FALSE; static long hwndSetMyAvatar = 0; -static HANDLE hMyAvatarsFolder = 0; -static HANDLE hGlobalAvatarFolder = 0; -static HANDLE hLoaderEvent = 0; -static HANDLE hLoaderThread = 0; - -static HANDLE hOptInit = 0; -static HANDLE hModulesLoaded = 0; -static HANDLE hPresutdown = 0; -static HANDLE hOkToExit = 0; -static HANDLE hAccChanged = 0; - -HANDLE hProtoAckHook = 0, hContactSettingChanged = 0, hEventChanged = 0, hEventContactAvatarChanged = 0, - hMyAvatarChanged = 0, hEventDeleted = 0, hUserInfoInitHook = 0; +static HANDLE hMyAvatarsFolder; +static HANDLE hGlobalAvatarFolder; +static HANDLE hLoaderEvent, hLoaderThread; +HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged; + HICON g_hIcon = 0; BOOL (WINAPI *AvsAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION) = NULL; @@ -502,7 +494,7 @@ int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) if (CallProtoService(szProto, PS_GETMYAVATAR, (WPARAM)szFileName, (LPARAM)MAX_PATH)) tszFilename[0] = '\0'; else - MultiByteToWideChar( CP_ACP, 0, szFileName, -1, tszFilename, SIZEOF( tszFilename )); + MultiByteToWideChar( CP_ACP, 0, szFileName, -1, tszFilename, SIZEOF(tszFilename)); } else if (!DBGetContactSettingTString(NULL, szProto, "AvatarFile", &dbv)) { AVS_pathToAbsolute(dbv.ptszVal, tszFilename); @@ -1910,34 +1902,6 @@ static int MetaChanged(WPARAM wParam, LPARAM lParam) return 0; } -static LIST arServices( 10 ); - -static int DestroyServicesAndEvents() -{ - UnhookEvent(hContactSettingChanged); - UnhookEvent(hProtoAckHook); - UnhookEvent(hUserInfoInitHook); - UnhookEvent(hOptInit); - UnhookEvent(hModulesLoaded); - UnhookEvent(hPresutdown); - UnhookEvent(hOkToExit); - UnhookEvent(hAccChanged); - - for ( int i=0; i < arServices.getCount(); i++ ) - DestroyServiceFunction( arServices[i] ); - - arServices.destroy(); - - DestroyHookableEvent(hEventChanged); - DestroyHookableEvent(hEventContactAvatarChanged); - DestroyHookableEvent(hMyAvatarChanged); - hEventChanged = 0; - hEventContactAvatarChanged = 0; - hMyAvatarChanged = 0; - UnhookEvent(hEventDeleted); - return 0; -} - static void LoadDefaultInfo() { protoPicCacheEntry* pce = new protoPicCacheEntry; @@ -2060,11 +2024,10 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) pce->szProtoname = mir_strdup(""); g_MyAvatars.insert( pce ); - hAccChanged = HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged); - hPresutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownProc); - hOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT, OkToExitProc); - hUserInfoInitHook = HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit); - + HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged); + HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownProc); + HookEvent(ME_SYSTEM_OKTOEXIT, OkToExitProc); + HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit); return 0; } @@ -2151,8 +2114,7 @@ static int ContactDeleted(WPARAM wParam, LPARAM lParam) static int OptInit(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; odp.flags = ODPF_BOLDGROUPS; odp.pszGroup = LPGEN("Contacts"); @@ -2172,7 +2134,6 @@ static int OptInit(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_OWN); odp.pfnDlgProc = DlgProcOptionsOwn; Options_AddPage(wParam, &odp); - return 0; } @@ -2181,7 +2142,9 @@ static int OkToExitProc(WPARAM wParam, LPARAM lParam) EnterCriticalSection(&cachecs); g_shutDown = TRUE; - DestroyServicesAndEvents(); + DestroyHookableEvent(hEventChanged); hEventChanged = 0; + DestroyHookableEvent(hEventContactAvatarChanged); hEventContactAvatarChanged = 0; + DestroyHookableEvent(hMyAvatarChanged); hMyAvatarChanged = 0; LeaveCriticalSection(&cachecs); @@ -2394,27 +2357,27 @@ static int LoadAvatarModule() InitializeCriticalSection(&cachecs); InitializeCriticalSection(&alloccs); - hOptInit = HookEvent(ME_OPT_INITIALISE, OptInit); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); - hEventDeleted = HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); - hProtoAckHook = HookEvent(ME_PROTO_ACK, ProtocolAck); - - arServices.insert( CreateServiceFunction( MS_AV_GETAVATARBITMAP, GetAvatarBitmap )); - arServices.insert( CreateServiceFunction( MS_AV_PROTECTAVATAR, ProtectAvatar )); - arServices.insert( CreateServiceFunction( MS_AV_SETAVATAR, SetAvatar )); - arServices.insert( CreateServiceFunction( MS_AV_SETMYAVATAR, SetMyAvatar )); - arServices.insert( CreateServiceFunction( MS_AV_CANSETMYAVATAR, CanSetMyAvatar )); - arServices.insert( CreateServiceFunction( MS_AV_CONTACTOPTIONS, ContactOptions )); - arServices.insert( CreateServiceFunction( MS_AV_DRAWAVATAR, DrawAvatarPicture )); - arServices.insert( CreateServiceFunction( MS_AV_GETMYAVATAR, GetMyAvatar )); - arServices.insert( CreateServiceFunction( MS_AV_REPORTMYAVATARCHANGED, ReportMyAvatarChanged )); - arServices.insert( CreateServiceFunction( MS_AV_LOADBITMAP32, BmpFilterLoadBitmap32 )); - arServices.insert( CreateServiceFunction( MS_AV_SAVEBITMAP, BmpFilterSaveBitmap )); - arServices.insert( CreateServiceFunction( MS_AV_CANSAVEBITMAP, BmpFilterCanSaveBitmap )); - arServices.insert( CreateServiceFunction( MS_AV_RESIZEBITMAP, BmpFilterResizeBitmap )); - arServices.insert( CreateServiceFunction( MS_AV_SETAVATARW, SetAvatarW )); - arServices.insert( CreateServiceFunction( MS_AV_SETMYAVATARW, SetMyAvatarW )); + HookEvent(ME_OPT_INITIALISE, OptInit); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); + HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); + HookEvent(ME_PROTO_ACK, ProtocolAck); + + CreateServiceFunction(MS_AV_GETAVATARBITMAP, GetAvatarBitmap); + CreateServiceFunction(MS_AV_PROTECTAVATAR, ProtectAvatar); + CreateServiceFunction(MS_AV_SETAVATAR, SetAvatar); + CreateServiceFunction(MS_AV_SETMYAVATAR, SetMyAvatar); + CreateServiceFunction(MS_AV_CANSETMYAVATAR, CanSetMyAvatar); + CreateServiceFunction(MS_AV_CONTACTOPTIONS, ContactOptions); + CreateServiceFunction(MS_AV_DRAWAVATAR, DrawAvatarPicture); + CreateServiceFunction(MS_AV_GETMYAVATAR, GetMyAvatar); + CreateServiceFunction(MS_AV_REPORTMYAVATARCHANGED, ReportMyAvatarChanged); + CreateServiceFunction(MS_AV_LOADBITMAP32, BmpFilterLoadBitmap32); + CreateServiceFunction(MS_AV_SAVEBITMAP, BmpFilterSaveBitmap); + CreateServiceFunction(MS_AV_CANSAVEBITMAP, BmpFilterCanSaveBitmap); + CreateServiceFunction(MS_AV_RESIZEBITMAP, BmpFilterResizeBitmap); + CreateServiceFunction(MS_AV_SETAVATARW, SetAvatarW); + CreateServiceFunction(MS_AV_SETMYAVATARW, SetMyAvatarW); hEventChanged = CreateHookableEvent(ME_AV_AVATARCHANGED); hEventContactAvatarChanged = CreateHookableEvent(ME_AV_CONTACTAVATARCHANGED); diff --git a/plugins/AVS/src/mir_thread.cpp b/plugins/AVS/src/mir_thread.cpp index d12a0c9731..f1eb547b8f 100644 --- a/plugins/AVS/src/mir_thread.cpp +++ b/plugins/AVS/src/mir_thread.cpp @@ -17,32 +17,25 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "commonheaders.h" - BOOL g_shutDown = FALSE; static HANDLE hShutdownEvent = NULL; -static HANDLE hOkToExit = NULL; - static int OkToExitProc(WPARAM wParam, LPARAM lParam) { g_shutDown = TRUE; SetEvent(hShutdownEvent); CloseHandle(hShutdownEvent); - UnhookEvent(hOkToExit); return 0; } - void init_mir_thread() { hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - hOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT, OkToExitProc); + HookEvent(ME_SYSTEM_OKTOEXIT, OkToExitProc); } - void mir_sleep(int time) { if (!g_shutDown) diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 1c41ecd299..16fba6994f 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -20,11 +20,10 @@ #include "commonheaders.h" HINSTANCE g_hInst; -static HANDLE hHookModulesLoaded = NULL, hSystemOKToExit = NULL, hOptInitialise = NULL, hIcoLibIconsChanged = NULL; -static HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hContactSettingChanged = NULL, hContactAdded = NULL; -static HANDLE hPrebuildContactMenu = NULL, hAuthMenuSelected = NULL; -static HANDLE hUserMenu = NULL; -HANDLE hExtraIcon = NULL; +static HANDLE hOptInitialise; +static HANDLE hHookExtraIconsRebuild, hHookExtraIconsApply; +static HANDLE hAuthMenuSelected, hUserMenu; +HANDLE hExtraIcon; int hLangpack; BYTE bUseAuthIcon = 0, bUseGrantIcon = 0, bContactMenuItem = 0, bIconsForRecentContacts = 0, bUseAuthGroup = 0; @@ -186,28 +185,15 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) } hOptInitialise = HookEvent(ME_OPT_INITIALISE, onOptInitialise); - if (bContactMenuItem) hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu); + if (bContactMenuItem) + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu); return 0; } int onSystemOKToExit(WPARAM wParam,LPARAM lParam) { - UnhookEvent(hHookModulesLoaded); - UnhookEvent(hHookExtraIconsRebuild); - UnhookEvent(hHookExtraIconsApply); - UnhookEvent(hOptInitialise); - UnhookEvent(hSystemOKToExit); - UnhookEvent(hContactSettingChanged); - if (hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged); - if (hContactAdded) UnhookEvent(hContactAdded); - if (hPrebuildContactMenu) - { - UnhookEvent(hPrebuildContactMenu); - UnhookEvent(hUserMenu); - } DestroyServiceFunction(hAuthMenuSelected); - return 0; } @@ -215,16 +201,16 @@ extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); - hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); - hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); - hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); + HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); + HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged); bUseAuthIcon = DBGetContactSettingByte(NULL, MODULENAME, "EnableAuthIcon", 1); bUseGrantIcon = DBGetContactSettingByte(NULL, MODULENAME, "EnableGrantIcon", 1); bContactMenuItem = DBGetContactSettingByte(NULL, MODULENAME, "MenuItem", 0); bIconsForRecentContacts = DBGetContactSettingByte(NULL, MODULENAME, "EnableOnlyForRecent", 0); - hContactAdded = HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded); + HookEvent(ME_DB_CONTACT_ADDED, onDBContactAdded); if (bContactMenuItem) { diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 66715892ca..7331e958c7 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -31,7 +31,7 @@ // unique to this DLL, not to be shared HINSTANCE g_hInstance; CLIST_INTERFACE *pcli; -HANDLE g_hmGenMenuInit, g_hMenuItem, g_hHideService, g_hIsHiddenService; +HANDLE g_hMenuItem, g_hHideService, g_hIsHiddenService; HWINEVENTHOOK g_hWinHook; HWND g_hListenWindow, hDlg, g_hDlgPass, hOldForegroundWindow; HWND_ITEM *g_pMirWnds; // a pretty simple linked list @@ -628,16 +628,13 @@ void BossKeyMenuItemInit(void) // Add menu item g_hMenuItem = Menu_AddMainMenuItem(&mi); - g_hmGenMenuInit = HookEvent(ME_CLIST_PREBUILDMAINMENU, GenMenuInit); + HookEvent(ME_CLIST_PREBUILDMAINMENU, GenMenuInit); } void BossKeyMenuItemUnInit(void) // Remove menu item { CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)g_hMenuItem, 0); g_hMenuItem = 0; - if(g_hmGenMenuInit) - UnhookEvent(g_hmGenMenuInit); - g_hmGenMenuInit = 0; } void RegisterCoreHotKeys (void) @@ -841,9 +838,6 @@ extern "C" int __declspec(dllexport) Unload(void) { UninitIdleTimer(); - if(g_hmGenMenuInit) - UnhookEvent(g_hmGenMenuInit); - if (g_hWinHook != 0) UnhookWinEvent(g_hWinHook); diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index e57d69045b..65c2cbbfbd 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -26,21 +26,8 @@ int hLangpack; DWORD timer_id = 0; -HANDLE hEventContactSetting = NULL; -HANDLE hEventContactAdded = NULL; -HANDLE hEventUserInfoInit = NULL; -HANDLE hPrebuildContactMenu = NULL; -HANDLE hContactMenu = NULL; -HANDLE hIcoLibIconsChanged = NULL; -HANDLE hContactReturnedAction = NULL; -HANDLE hContactStillAbsentAction = NULL; -HANDLE hMissYouAction = NULL; -HANDLE hMenuMissYouClick = NULL; -HANDLE hModulesLoaded = NULL; -HANDLE hModulesLoaded2 = NULL; -HANDLE hSystemOKToExit = NULL; -HANDLE hHookExtraIconsRebuild = NULL; -HANDLE hHookExtraIconsApply = NULL; +HANDLE hContactReturnedAction, hContactStillAbsentAction, hMissYouAction, hMenuMissYouClick; +HANDLE hContactMenu; HICON hIcon; HANDLE hExtraIcon; @@ -663,7 +650,7 @@ int ModulesLoaded2(WPARAM wParam, LPARAM lParam) int ModulesLoaded(WPARAM wParam, LPARAM lParam) { - hEventUserInfoInit = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit); + HookEvent(ME_USERINFO_INITIALISE, UserinfoInit); // add sounds support SkinAddNewSoundExT("buddyExpectatorReturn", LPGENT("BuddyExpectator"), LPGENT("Contact returned")); @@ -673,7 +660,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) timer_id = SetTimer(0, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours - hModulesLoaded2 = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2); if (options.MissYouIcon) hExtraIcon = ExtraIcon_Register("buddy_exp", "Buddy Expectator", "enabled_icon"); @@ -681,12 +668,12 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) Icon_Register(hInst, "BuddyExpectator", iconList, SIZEOF(iconList)); - hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onIconsChanged); + HookEvent(ME_SKIN2_ICONSCHANGED, onIconsChanged); onIconsChanged(0,0); if (options.enableMissYou) { - hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu); CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR; @@ -728,29 +715,12 @@ int ContactAdded(WPARAM wParam, LPARAM lParam) int onSystemOKToExit(WPARAM wParam,LPARAM lParam) { - UnhookEvent(hEventContactSetting); - UnhookEvent(hEventContactAdded); - UnhookEvent(hEventUserInfoInit); - if (hPrebuildContactMenu) UnhookEvent(hPrebuildContactMenu); - UnhookEvent(hIcoLibIconsChanged); - UnhookEvent(hModulesLoaded); - UnhookEvent(hModulesLoaded2); - UnhookEvent(hSystemOKToExit); - UnhookEvent(hHookExtraIconsRebuild); - UnhookEvent(hHookExtraIconsApply); - DestroyServiceFunction(hContactReturnedAction); DestroyServiceFunction(hContactStillAbsentAction); DestroyServiceFunction(hMissYouAction); DestroyServiceFunction(hMenuMissYouClick); - DeinitOptions(); - - if (hIcoLibIconsChanged) - Skin_ReleaseIcon(hIcon); - else - DestroyIcon(hIcon); - + Skin_ReleaseIcon(hIcon); return 0; } @@ -767,11 +737,11 @@ extern "C" int __declspec(dllexport) Load(void) hMissYouAction = CreateServiceFunction("BuddyExpectator/actionMissYou", MissYouAction); hMenuMissYouClick = CreateServiceFunction("BuddyExpectator/actionMissYouClick", MenuMissYouClick); - hEventContactSetting = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit); - hEventContactAdded = HookEvent(ME_DB_CONTACT_ADDED, ContactAdded); + HookEvent(ME_DB_CONTACT_ADDED, ContactAdded); // ensure all contacts are timestamped DBVARIANT dbv; diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index badcc23d47..078d699eb4 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -560,14 +560,8 @@ int UserinfoInit(WPARAM wparam, LPARAM lparam) } -HANDLE hEventOptInitialise; void InitOptions() { LoadOptions(); - hEventOptInitialise = HookEvent(ME_OPT_INITIALISE, OptionsInit); -} - -void DeinitOptions() -{ - UnhookEvent(hEventOptInitialise); + HookEvent(ME_OPT_INITIALISE, OptionsInit); } diff --git a/plugins/BuddyExpectator/src/options.h b/plugins/BuddyExpectator/src/options.h index ade65c50e6..87e1f5e931 100644 --- a/plugins/BuddyExpectator/src/options.h +++ b/plugins/BuddyExpectator/src/options.h @@ -59,6 +59,5 @@ typedef struct { extern Options options; void InitOptions(); -void DeinitOptions(); #endif diff --git a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp index 7daa97cf9d..c0456bb1e1 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp @@ -1,6 +1,5 @@ #include -HANDLE hOnCntMenuBuild; HANDLE hPriorityItem = 0, hFloatingItem = 0; static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) @@ -34,14 +33,6 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) int MTG_OnmodulesLoad(WPARAM wParam,LPARAM lParam) { - hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild); - return 0; -} - -int UnloadMoveToGroup(void) -{ - if (hOnCntMenuBuild) - UnhookEvent(hOnCntMenuBuild); - + HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild); return 0; } diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 99e1ff7668..36ca706c00 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -46,9 +46,7 @@ extern int during_sizing; HIMAGELIST hCListImages; -HANDLE hIcoLibChanged = 0, hSvc_GetContactStatusMsg = 0; - -static HANDLE hClcSettingsChanged, hClcDBEvent = 0; +HANDLE hSvc_GetContactStatusMsg = 0; static HRESULT(WINAPI *MyCloseThemeData)(HANDLE); @@ -195,10 +193,6 @@ static int ClcPreshutdown(WPARAM wParam, LPARAM lParam) cfg::shutDown = TRUE; if (hSvc_GetContactStatusMsg) DestroyServiceFunction(hSvc_GetContactStatusMsg); - UnhookEvent(hClcSettingsChanged); - UnhookEvent(hClcDBEvent); - if (hIcoLibChanged) - UnhookEvent(hIcoLibChanged); return 0; } @@ -244,8 +238,8 @@ int LoadCLCModule(void) hCListImages = (HIMAGELIST) CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); - hClcSettingsChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged); - hClcDBEvent = HookEvent(ME_DB_EVENT_ADDED, ClcEventAdded); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged); + HookEvent(ME_DB_EVENT_ADDED, ClcEventAdded); HookEvent(ME_OPT_INITIALISE, ClcOptInit); HookEvent(ME_SYSTEM_SHUTDOWN, ClcPreshutdown); return 0; diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index e6dcd1022b..f3544e008c 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -86,7 +86,6 @@ void FLT_SnapToEdges(HWND hwnd); void DestroyTrayMenu(HMENU hMenu); extern LONG g_cxsmIcon, g_cysmIcon; -extern HANDLE hIcoLibChanged; SIZE g_oldSize = {0}; POINT g_oldPos = {0}; @@ -340,7 +339,7 @@ void CLN_LoadAllIcons(BOOL mode) { if (mode) { InitIcoLib(); - hIcoLibChanged = HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibChanged); + HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibChanged); } CacheClientIcons(); } 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; } diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 3fa6b2b6ec..e535738ffb 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -66,14 +66,13 @@ CContactCache::CContactCache(): m_cache(50, TContactInfo::cmp) int (__cdecl CContactCache::*pfn)(WPARAM, LPARAM); pfn = &CContactCache::OnDbEventAdded; - m_hOnDbEventAdded = HookEventObj(ME_DB_EVENT_ADDED, *(MIRANDAHOOKOBJ *)&pfn, this); + HookEventObj(ME_DB_EVENT_ADDED, *(MIRANDAHOOKOBJ *)&pfn, this); Rebuild(); } CContactCache::~CContactCache() { - UnhookEvent(m_hOnDbEventAdded); DeleteCriticalSection(&m_cs); } diff --git a/plugins/FavContacts/src/contact_cache.h b/plugins/FavContacts/src/contact_cache.h index 905ba4b469..d4a47ba477 100644 --- a/plugins/FavContacts/src/contact_cache.h +++ b/plugins/FavContacts/src/contact_cache.h @@ -39,7 +39,6 @@ private: OBJLIST m_cache; unsigned long m_lastUpdate; CRITICAL_SECTION m_cs; - HANDLE m_hOnDbEventAdded; int __cdecl OnDbEventAdded(WPARAM wParam, LPARAM lParam); float GetEventWeight(unsigned long age); diff --git a/plugins/FirstRun/src/main.cpp b/plugins/FirstRun/src/main.cpp index dddf45c9c6..23a9867d1a 100644 --- a/plugins/FirstRun/src/main.cpp +++ b/plugins/FirstRun/src/main.cpp @@ -2,7 +2,6 @@ HINSTANCE hInst; -HANDLE hModulesLoaded; int hLangpack; PLUGININFOEX pluginInfo={ @@ -50,14 +49,12 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void) { - mir_getLP(&pluginInfo); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); return 0; } extern "C" __declspec(dllexport) int Unload(void) { - UnhookEvent(hModulesLoaded); return 0; } \ No newline at end of file diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index 543ec53e71..6f7b25eec0 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -63,8 +63,6 @@ HANDLE hNetlibUser; static char pluginName[64]; -static HANDLE hHooks[4]; -static HANDLE hServices[7]; static CriticalSection cs; static HANDLE hAvatarsFolder = NULL; @@ -575,17 +573,17 @@ static int systemModulesLoaded(WPARAM /*wParam*/, LPARAM /*lParam*/) init(); MyAtlAxAttachControl = (LPAtlAxAttachControl)GetProcAddress(hAtl, "AtlAxAttachControl"); - hServices[0] = CreateServiceFunction(MS_FAVATAR_DESTROY, destroyAvatar); - hServices[1] = CreateServiceFunction(MS_FAVATAR_MAKE, makeAvatar); - hServices[2] = CreateServiceFunction(MS_FAVATAR_RESIZE, resizeAvatar); - hServices[3] = CreateServiceFunction(MS_FAVATAR_SETPOS, setPos); - hServices[4] = CreateServiceFunction(MS_FAVATAR_GETINFO, getInfo); - hServices[5] = CreateServiceFunction(MS_FAVATAR_SETEMOFACE, setEmoFace); - hServices[6] = CreateServiceFunction(MS_FAVATAR_SETBKCOLOR, setBkColor); + CreateServiceFunction(MS_FAVATAR_DESTROY, destroyAvatar); + CreateServiceFunction(MS_FAVATAR_MAKE, makeAvatar); + CreateServiceFunction(MS_FAVATAR_RESIZE, resizeAvatar); + CreateServiceFunction(MS_FAVATAR_SETPOS, setPos); + CreateServiceFunction(MS_FAVATAR_GETINFO, getInfo); + CreateServiceFunction(MS_FAVATAR_SETEMOFACE, setEmoFace); + CreateServiceFunction(MS_FAVATAR_SETBKCOLOR, setBkColor); - hHooks[1] = HookEvent(ME_DB_EVENT_ADDED, eventAdded); - hHooks[2] = HookEvent("Miranda/StatusChange/ContactStatusChanged", statusChanged); // NewStatusNotify - hHooks[3] = HookEvent(ME_CLIST_STATUSMODECHANGE, ownStatusChanged); + HookEvent(ME_DB_EVENT_ADDED, eventAdded); + HookEvent("Miranda/StatusChange/ContactStatusChanged", statusChanged); // NewStatusNotify + HookEvent(ME_CLIST_STATUSMODECHANGE, ownStatusChanged); NETLIBUSER nl_user = {0}; nl_user.cbSize = sizeof(nl_user); @@ -619,8 +617,7 @@ extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); - hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded); - + HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded); return 0; } @@ -642,16 +639,6 @@ extern "C" int __declspec(dllexport) Unload(void) FlashList.destroy(); } - int i; - - for (i = 0; i < SIZEOF(hHooks); i++) - if (hHooks[i]) - UnhookEvent(hHooks[i]); - - for (i = 0; i < SIZEOF(hServices); i++) - if (hServices[i]) - DestroyServiceFunction(hServices[i]); - if (hNetlibUser) CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)hNetlibUser, 0); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 47d17555c5..216188c5b0 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -67,17 +67,6 @@ HMODULE hUserDll = NULL; HFONT hFont[FLT_FONTIDS] = {NULL}; COLORREF tColor[FLT_FONTIDS] = {0}; HIMAGELIST himl = NULL; -HANDLE hevContactIcon = NULL; -HANDLE hevContactDrop = NULL; -HANDLE hevContactDragStop = NULL; -HANDLE hevSkinIcons = NULL; -HANDLE hevContactDrag = NULL; -HANDLE hevContactSetting = NULL; -HANDLE hevContactDeleted = NULL; -HANDLE hevOptionsInit = NULL; -HANDLE hevStatusMode = NULL; -HANDLE hevModules = NULL; -HANDLE hevPrebuildMenu = NULL; HANDLE hNewContact = NULL; HPEN hLTEdgesPen = NULL; @@ -162,7 +151,7 @@ extern "C" int __declspec(dllexport) Load() mir_getLP(&pluginInfoEx); - hevModules = HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoded ); + HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoded ); bNT = GetOSPlatform(); if (hUserDll = LoadLibrary(_T("user32.dll"))) { @@ -191,18 +180,6 @@ static void CleanUp() { int nFontId; - UnhookEvent( hevContactIcon ); - UnhookEvent( hevContactDrag ); - UnhookEvent( hevContactDrop ); - UnhookEvent( hevContactDragStop ); - UnhookEvent( hevSkinIcons ); - UnhookEvent( hevContactDeleted ); - UnhookEvent( hevContactSetting ); - UnhookEvent( hevOptionsInit ); - UnhookEvent( hevStatusMode ); - UnhookEvent( hevModules ); - UnhookEvent( hevPrebuildMenu ); - if (hRemoveThumb) DestroyServiceFunction(hRemoveThumb); if (hMainHideAllThumbs) @@ -245,18 +222,18 @@ static void CleanUp() // Hooked events static int OnModulesLoded( WPARAM wParam, LPARAM lParam ) { - hevContactIcon = HookEvent( ME_CLIST_CONTACTICONCHANGED, OnContactIconChanged ); - hevSkinIcons = HookEvent( ME_SKIN_ICONSCHANGED, OnSkinIconsChanged ); - hevContactDrag = HookEvent( ME_CLUI_CONTACTDRAGGING, OnContactDrag ); - hevContactDrop = HookEvent( ME_CLUI_CONTACTDROPPED, OnContactDrop ); - hevContactDragStop = HookEvent( ME_CLUI_CONTACTDRAGSTOP, OnContactDragStop ); - hevContactSetting = HookEvent( ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged ); - hevContactDeleted = HookEvent( ME_DB_CONTACT_DELETED, OnContactDeleted ); - hevOptionsInit = HookEvent( ME_OPT_INITIALISE, OnOptionsInitialize ); - hevStatusMode = HookEvent( ME_CLIST_STATUSMODECHANGE, OnStatusModeChange ); - hevPrebuildMenu = HookEvent( ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu ); - hwndMiranda = (HWND)CallService( MS_CLUI_GETHWND, 0, 0 ); - + HookEvent( ME_CLIST_CONTACTICONCHANGED, OnContactIconChanged ); + HookEvent( ME_SKIN_ICONSCHANGED, OnSkinIconsChanged ); + HookEvent( ME_CLUI_CONTACTDRAGGING, OnContactDrag ); + HookEvent( ME_CLUI_CONTACTDROPPED, OnContactDrop ); + HookEvent( ME_CLUI_CONTACTDRAGSTOP, OnContactDragStop ); + HookEvent( ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged ); + HookEvent( ME_DB_CONTACT_DELETED, OnContactDeleted ); + HookEvent( ME_OPT_INITIALISE, OnOptionsInitialize ); + HookEvent( ME_CLIST_STATUSMODECHANGE, OnStatusModeChange ); + HookEvent( ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu ); + + hwndMiranda = (HWND)CallService( MS_CLUI_GETHWND, 0, 0 ); mir_subclassWindow(hwndMiranda, newMirandaWndProc); // No thumbs yet diff --git a/plugins/Folders/src/folders.cpp b/plugins/Folders/src/folders.cpp index d9e61f675f..e44a7f7485 100644 --- a/plugins/Folders/src/folders.cpp +++ b/plugins/Folders/src/folders.cpp @@ -58,7 +58,6 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload() { DestroyEvents(); - UnhookEvents(); return 0; } diff --git a/plugins/Folders/src/hooked_events.cpp b/plugins/Folders/src/hooked_events.cpp index cc939a4e7b..6846f33c04 100644 --- a/plugins/Folders/src/hooked_events.cpp +++ b/plugins/Folders/src/hooked_events.cpp @@ -20,24 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -HANDLE hOptionsInitialize; - -int HookEvents() -{ - hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); - return 0; -} - -int UnhookEvents() -{ - UnhookEvent(hOptionsInitialize); - return 0; -} - -int OnOptionsInitialize(WPARAM wParam, LPARAM lParam) +static int OnOptionsInitialize(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; odp.hInstance = hInstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FOLDERS); @@ -49,4 +34,10 @@ int OnOptionsInitialize(WPARAM wParam, LPARAM lParam) Options_AddPage(wParam, &odp); return 0; -} \ No newline at end of file +} + +int HookEvents() +{ + HookEvent(ME_OPT_INITIALISE, OnOptionsInitialize); + return 0; +} diff --git a/plugins/Folders/src/hooked_events.h b/plugins/Folders/src/hooked_events.h index 7a2d427e18..0df8dc07ce 100644 --- a/plugins/Folders/src/hooked_events.h +++ b/plugins/Folders/src/hooked_events.h @@ -26,9 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HANDLE hOptionsInitialize; -int UnhookEvents(); int HookEvents(); -int OnOptionsInitialize(WPARAM wParam, LPARAM lParam); #endif \ No newline at end of file diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index d4c1fdd011..64e17a8b63 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -817,9 +817,6 @@ int PreShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { ///////////////////////////////////////////////////////////////////// int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { - if (hEventProtoAck) - UnhookEvent(hEventProtoAck); - while (pclFirstNode) { CLFileShareNode * pclCur = pclFirstNode; pclFirstNode = pclFirstNode->pclNext; @@ -827,10 +824,6 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { } pclFirstNode = NULL; - if (hEventSystemInit) { - UnhookEvent(hEventSystemInit); - hEventSystemInit = 0; - } UnInitGuiElements(); db_set_b(NULL, MODULE, "IndexCreationMode", (BYTE)indexCreationMode); diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index 47b9ecc859..d3889376a5 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -47,10 +47,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) extern "C" __declspec(dllexport) int Load(void) { - WNDCLASS wndclass; - - mir_getLP(&pluginInfo); + // Load Rich Edit control hRichEdit = LoadLibrary(_T("RICHED32.DLL")); if (!hRichEdit) @@ -81,16 +79,14 @@ extern "C" __declspec(dllexport) int Load(void) hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + WNDCLASS wndclass = { 0 }; wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = ProgressBarDlg; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; wndclass.hInstance = hInst; wndclass.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LINKLISTICON)); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wndclass.lpszClassName = _T("Progressbar"); - wndclass.lpszMenuName = NULL; RegisterClass(&wndclass); splitCursor = LoadCursor(NULL, IDC_SIZENS); @@ -108,7 +104,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Unload(void) { - UnhookEvent(ME_DB_EVENT_ADDED); DestroyCursor(splitCursor); return 0; } @@ -142,7 +137,6 @@ static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam) int actCount = 0; RECT DesktopRect; - DIALOGPARAM *DlgParam; LISTELEMENT *listStart; UNREFERENCED_PARAMETER(lParam); @@ -223,9 +217,7 @@ static INT_PTR LinkList_Main(WPARAM wParam,LPARAM lParam) return 0; } - - - DlgParam = (DIALOGPARAM*)malloc(sizeof(DIALOGPARAM)); + DIALOGPARAM *DlgParam = (DIALOGPARAM*)malloc(sizeof(DIALOGPARAM)); DlgParam->hContact = hContact; DlgParam->listStart = listStart; DlgParam->findMessage = 0; diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 5fcc1fb8ce..cf2cd64374 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -412,7 +412,7 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb ) ///////////////////////////////////////////////////////////////////// -// Member Function : Initilize +// Member Function : Initialize // Type : Global // Parameters : None // Returns : void @@ -424,7 +424,7 @@ int CLStreamRTFInfo::nLoadFileStream( LPBYTE pbBuff , LONG cb ) // Developer : KN ///////////////////////////////////////////////////////////////////// -void Initilize() +void Initialize() { InitializeCriticalSection( &csHistoryList ); } diff --git a/plugins/Msg_Export/src/FileViewer.h b/plugins/Msg_Export/src/FileViewer.h index 737674d61a..0315201010 100755 --- a/plugins/Msg_Export/src/FileViewer.h +++ b/plugins/Msg_Export/src/FileViewer.h @@ -19,7 +19,7 @@ #ifndef MSG_EXP_FILE_VIEWER #define MSG_EXP_FILE_VIEWER -void Initilize(); +void Initialize(); void Uninitilize(); void UpdateFileViews( const _TCHAR * pszFile ); diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 25f08c78f2..83ac2b70ff 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -21,15 +21,6 @@ HINSTANCE hInstance = NULL; int hLangpack = 0; -// static so they can not be used from other modules ( sourcefiles ) -static HANDLE hEventOptionsInitialize = 0; -static HANDLE hDBEventAdded = 0; -static HANDLE hDBContactDeleted = 0; -static HANDLE hEventSystemInit = 0; -static HANDLE hEventSystemShutdown = 0; - -static HANDLE hServiceFunc = 0; - static HANDLE hOpenHistoryMenuItem = 0; HANDLE hInternalWindowList = NULL; @@ -95,42 +86,6 @@ static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM /*lParam*/) int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) { WindowList_Broadcast(hInternalWindowList, WM_CLOSE, 0, 0); - - if (hEventOptionsInitialize) - { - UnhookEvent(hEventOptionsInitialize); - hEventOptionsInitialize = 0; - } - - if (hDBEventAdded) - { - UnhookEvent(hDBEventAdded); - hDBEventAdded = 0; - } - - if (hDBContactDeleted) - { - UnhookEvent(hDBContactDeleted); - hDBContactDeleted = 0; - } - - if (hServiceFunc) - { - DestroyServiceFunction(hServiceFunc); - hServiceFunc = 0; - } - - if (hEventSystemInit) - { - UnhookEvent(hEventSystemInit); - hEventSystemInit = 0; - } - - if (hEventSystemShutdown) - { - UnhookEvent(hEventSystemShutdown); // here we unhook the fun we are in, might not bee good - hEventSystemShutdown = 0; - } return 0; } @@ -150,23 +105,14 @@ int nSystemShutdown(WPARAM /*wparam*/, LPARAM /*lparam*/) int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) { - - Initilize(); + Initialize(); bReadMirandaDirAndPath(); UpdateFileToColWidth(); - hDBEventAdded = HookEvent(ME_DB_EVENT_ADDED, nExportEvent); - if ( !hDBEventAdded) - MessageBox(NULL, TranslateT("Failed to HookEvent ME_DB_EVENT_ADDED"), MSG_BOX_TITEL, MB_OK); - - hDBContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, nContactDeleted); - if ( !hDBContactDeleted) - MessageBox(NULL, TranslateT("Failed to HookEvent ME_DB_CONTACT_DELETED"), MSG_BOX_TITEL, MB_OK); - - hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); - if ( !hEventOptionsInitialize) - MessageBox(NULL, TranslateT("Failed to HookEvent ME_OPT_INITIALISE"), MSG_BOX_TITEL, MB_OK); + HookEvent(ME_DB_EVENT_ADDED, nExportEvent); + HookEvent(ME_DB_CONTACT_DELETED, nContactDeleted); + HookEvent(ME_OPT_INITIALISE, OptionsInitialize); if ( !bReplaceHistory) { @@ -183,11 +129,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) MessageBox(NULL, TranslateT("Failed to add menu item Open Exported History\nCallService(MS_CLIST_ADDCONTACTMENUITEM,...)"), MSG_BOX_TITEL, MB_OK); } - hEventSystemShutdown = HookEvent(ME_SYSTEM_SHUTDOWN, nSystemShutdown); - - if ( !hEventSystemShutdown) - MessageBox(NULL, TranslateT("Failed to HookEvent ME_SYSTEM_SHUTDOWN"), MSG_BOX_TITEL, MB_OK); - + HookEvent(ME_SYSTEM_SHUTDOWN, nSystemShutdown); return 0; } @@ -249,13 +191,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" __declspec(dllexport) int Load() { mir_getLP(&pluginInfo); - hEventSystemInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); - - if ( !hEventSystemInit) - { - MessageBox(NULL, TranslateT("Failed to HookEvent ME_SYSTEM_MODULESLOADED"), MSG_BOX_TITEL, MB_OK); - return 0; - } + HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); nMaxLineWidth = db_get_w(NULL, MODULE, "MaxLineWidth", nMaxLineWidth); if(nMaxLineWidth < 5) @@ -280,26 +216,14 @@ extern "C" __declspec(dllexport) int Load() // Plugin sweeper support db_set_ts(NULL, "Uninstall", "Message Export", _T(MODULE)); + HANDLE hServiceFunñ = 0; if (bReplaceHistory) - { - hServiceFunc = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowExportHistory); //this need new code + hServiceFunñ = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowExportHistory); //this need new code - if ( !hServiceFunc) - MessageBox(NULL, TranslateT("Failed to replace Miranda History.\r\nThis is most likely due to changes in Miranda."), MSG_BOX_TITEL, MB_OK); - } + if ( !hServiceFunñ) + hServiceFunñ = CreateServiceFunction(MS_SHOW_EXPORT_HISTORY, ShowExportHistory); - if ( !hServiceFunc) - { - hServiceFunc = CreateServiceFunction(MS_SHOW_EXPORT_HISTORY, ShowExportHistory); - } - - if ( !hServiceFunc) - { - MessageBox(NULL, TranslateT("Failed to CreateServiceFunction MS_SHOW_EXPORT_HISTORY"), MSG_BOX_TITEL, MB_OK); - } - hInternalWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); - return 0; } diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 2f250b799a..84437d2979 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -28,7 +28,6 @@ extern HBRUSH hListBkgBrush; extern HBRUSH hListSelectedBkgBrush; extern FONTINFO aFonts[OPTIONS_FONTCOUNT]; -HANDLE g_hOptions = NULL; static HWND hPathTip = 0; struct branch_t @@ -882,11 +881,11 @@ void SetIndentSize() int OptionsInit(void) { - LOGFONT lf; - - g_hOptions = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); + HookEvent(ME_OPT_INITIALISE, OptionsInitialize); LoadLogFonts(); + + LOGFONT lf; LoadMsgDlgFont(18, &lf, NULL, TRUE); lstrcpy(lf.lfFaceName, _T("MS Shell Dlg")); lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0; @@ -917,7 +916,6 @@ int OptionsInit(void) int OptionsUnInit(void) { FreeGlobalSettings(); - UnhookEvent(g_hOptions); DeleteObject(hListBkgBrush); DeleteObject(hListSelectedBkgBrush); DeleteObject(g_Settings.NameFont); diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index b1fa380e26..5057f53ab7 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -45,9 +45,6 @@ extern HMODULE g_hIconDLL; extern HIMAGELIST CreateStateImageList(); -HANDLE g_hOptions = NULL; - - #define FONTF_BOLD 1 #define FONTF_ITALIC 2 @@ -1418,7 +1415,6 @@ int OptionsInit(void) int OptionsUnInit(void) { FreeGlobalSettings(); - UnhookEvent(g_hOptions); DeleteObject(hListBkgBrush); DeleteObject(g_Settings.NameFont); return 0; diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 427dc7de89..9219d730f2 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -46,7 +46,6 @@ CRITICAL_SECTION cs; HANDLE hSendEvent; HANDLE hBuildMenuEvent; HANDLE hJoinMenuItem, hLeaveMenuItem; -HANDLE g_hHookPrebuildMenu; static HANDLE hServiceRegister = NULL, @@ -819,12 +818,11 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) void HookEvents(void) { InitializeCriticalSection(&cs); - g_hHookPrebuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu); // MIRANDAHOOK should return INT_PTR too + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu); // MIRANDAHOOK should return INT_PTR too } void UnhookEvents(void) { - UnhookEvent(g_hHookPrebuildMenu); DeleteCriticalSection(&cs); } diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index e68961c72e..1cad737eb4 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -87,7 +87,7 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) m_activeSubMenu = 0; m_fTracking = false; m_isContactMenu = m_isMainMenu = false; - m_hevHook = HookEventParam(ME_LANGPACK_CHANGED, &::resetLP, (LPARAM)this); + HookEventParam(ME_LANGPACK_CHANGED, &::resetLP, (LPARAM)this); ::SetWindowLongPtr(m_hwndToolbar, GWLP_USERDATA, (UINT_PTR)this); mir_subclassWindow(m_hwndToolbar, wndProc); @@ -97,7 +97,6 @@ CMenuBar::~CMenuBar() { ::SetWindowLongPtr(m_hwndToolbar, GWLP_USERDATA, 0); ::DestroyWindow(m_hwndToolbar); - ::UnhookEvent(m_hevHook); releaseHook(); m_MimIconRefCount--; if (m_MimIconRefCount == 0) { diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 6fc0edb842..b807218b0b 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -51,13 +51,6 @@ static TContainerSettings _cnt_default = { 0 }; -HANDLE CGlobals::m_event_ModulesLoaded = 0, CGlobals::m_event_PrebuildMenu = 0, CGlobals::m_event_SettingChanged = 0; -HANDLE CGlobals::m_event_ContactDeleted = 0, CGlobals::m_event_Dispatch = 0, CGlobals::m_event_EventAdded = 0; -HANDLE CGlobals::m_event_IconsChanged = 0, CGlobals::m_event_TypingEvent = 0, CGlobals::m_event_ProtoAck = 0; -HANDLE CGlobals::m_event_PreShutdown = 0, CGlobals::m_event_OkToExit = 0; -HANDLE CGlobals::m_event_IcoLibChanged = 0, CGlobals::m_event_AvatarChanged = 0, CGlobals::m_event_MyAvatarChanged = 0, CGlobals::m_event_FontsChanged = 0; -HANDLE CGlobals::m_event_SmileyAdd = 0, CGlobals::m_event_IEView = 0, CGlobals::m_event_FoldersChanged = 0; -HANDLE CGlobals::m_event_ME_MC_SUBCONTACTSCHANGED = 0, CGlobals::m_event_ME_MC_FORCESEND = 0, CGlobals::m_event_ME_MC_UNFORCESEND = 0; TCHAR* CGlobals::m_default_container_name = _T("default"); extern HANDLE hHookButtonPressedEvt; @@ -165,10 +158,8 @@ void CGlobals::reloadSystemModulesChanged() */ if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) { PluginConfig.g_SmileyAddAvail = 1; - m_event_SmileyAdd = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, ::SmileyAddOptionsChanged); + HookEvent(ME_SMILEYADD_OPTIONSCHANGED, ::SmileyAddOptionsChanged); } - else - m_event_SmileyAdd = 0; /* * Flashavatars @@ -186,11 +177,9 @@ void CGlobals::reloadSystemModulesChanged() if (bOldIEView != bIEView) M->WriteByte(SRMSGMOD_T, "default_ieview", 1); M->WriteByte(SRMSGMOD_T, "ieview_installed", 1); - m_event_IEView = HookEvent(ME_IEVIEW_OPTIONSCHANGED, ::IEViewOptionsChanged); - } else { - M->WriteByte(SRMSGMOD_T, "ieview_installed", 0); - m_event_IEView = 0; + HookEvent(ME_IEVIEW_OPTIONSCHANGED, ::IEViewOptionsChanged); } + else M->WriteByte(SRMSGMOD_T, "ieview_installed", 0); g_iButtonsBarGap = M->GetByte("ButtonsBarGap", 1); m_hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); @@ -341,18 +330,18 @@ const HMENU CGlobals::getMenuBar() */ void CGlobals::hookSystemEvents() { - m_event_ModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - m_event_IconsChanged = HookEvent(ME_SKIN_ICONSCHANGED, ::IconsChanged); - m_event_TypingEvent = HookEvent(ME_PROTO_CONTACTISTYPING, CMimAPI::TypingMessage); - m_event_ProtoAck = HookEvent(ME_PROTO_ACK, CMimAPI::ProtoAck); - m_event_PreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv); - m_event_OkToExit = HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit); - - m_event_PrebuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CMimAPI::PrebuildContactMenu); - - m_event_IcoLibChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ::IcoLibIconsChanged); - m_event_AvatarChanged = HookEvent(ME_AV_AVATARCHANGED, ::AvatarChanged); - m_event_MyAvatarChanged = HookEvent(ME_AV_MYAVATARCHANGED, ::MyAvatarChanged); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SKIN_ICONSCHANGED, ::IconsChanged); + HookEvent(ME_PROTO_CONTACTISTYPING, CMimAPI::TypingMessage); + HookEvent(ME_PROTO_ACK, CMimAPI::ProtoAck); + HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownSendRecv); + HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit); + + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CMimAPI::PrebuildContactMenu); + + HookEvent(ME_SKIN2_ICONSCHANGED, ::IcoLibIconsChanged); + HookEvent(ME_AV_AVATARCHANGED, ::AvatarChanged); + HookEvent(ME_AV_MYAVATARCHANGED, ::MyAvatarChanged); } /** @@ -361,8 +350,6 @@ void CGlobals::hookSystemEvents() int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) { - ::UnhookEvent(m_event_ModulesLoaded); - M->configureCustomFolders(); Skin->Init(true); @@ -423,17 +410,17 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) if (PluginConfig.g_PopupWAvail||PluginConfig.g_PopupAvail) TN_ModuleInit(); - m_event_SettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged); - m_event_ContactDeleted = HookEvent(ME_DB_CONTACT_DELETED, DBContactDeleted); + HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged); + HookEvent(ME_DB_CONTACT_DELETED, DBContactDeleted); - m_event_Dispatch = HookEvent(ME_DB_EVENT_ADDED, CMimAPI::DispatchNewEvent); - m_event_EventAdded = HookEvent(ME_DB_EVENT_ADDED, CMimAPI::MessageEventAdded); + HookEvent(ME_DB_EVENT_ADDED, CMimAPI::DispatchNewEvent); + HookEvent(ME_DB_EVENT_ADDED, CMimAPI::MessageEventAdded); if (PluginConfig.g_MetaContactsAvail) { - m_event_ME_MC_SUBCONTACTSCHANGED = HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent); - m_event_ME_MC_FORCESEND = HookEvent(ME_MC_FORCESEND, MetaContactEvent); - m_event_ME_MC_UNFORCESEND = HookEvent(ME_MC_UNFORCESEND, MetaContactEvent); + HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent); + HookEvent(ME_MC_FORCESEND, MetaContactEvent); + HookEvent(ME_MC_UNFORCESEND, MetaContactEvent); } - m_event_FontsChanged = HookEvent(ME_FONT_RELOAD, ::FontServiceFontsChanged); + HookEvent(ME_FONT_RELOAD, ::FontServiceFontsChanged); return 0; } @@ -636,7 +623,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam) int CGlobals::OkToExit(WPARAM wParam, LPARAM lParam) { - UnhookEvent(m_event_OkToExit); #if defined(__USE_EX_HANDLERS) __try { #endif @@ -646,34 +632,7 @@ int CGlobals::OkToExit(WPARAM wParam, LPARAM lParam) CWarning::destroyAll(); CMimAPI::m_shutDown = true; - UnhookEvent(m_event_EventAdded); - UnhookEvent(m_event_Dispatch); - UnhookEvent(m_event_PrebuildMenu); - UnhookEvent(m_event_SettingChanged); - UnhookEvent(m_event_ContactDeleted); - UnhookEvent(m_event_AvatarChanged); - UnhookEvent(m_event_MyAvatarChanged); - UnhookEvent(m_event_ProtoAck); - UnhookEvent(m_event_TypingEvent); - UnhookEvent(m_event_FontsChanged); - UnhookEvent(m_event_IcoLibChanged); - UnhookEvent(m_event_IconsChanged); - - if (m_event_SmileyAdd) - UnhookEvent(m_event_SmileyAdd); - - if (m_event_IEView) - UnhookEvent(m_event_IEView); - - if (m_event_FoldersChanged) - UnhookEvent(m_event_FoldersChanged); - - if (m_event_ME_MC_FORCESEND) { - UnhookEvent(m_event_ME_MC_FORCESEND); - UnhookEvent(m_event_ME_MC_SUBCONTACTSCHANGED); - UnhookEvent(m_event_ME_MC_UNFORCESEND); - } - ::ModPlus_PreShutdown(wParam, lParam); + PluginConfig.globalContainerSettings.fPrivate = false; ::DBWriteContactSettingBlob(0, SRMSGMOD_T, CNT_KEYNAME, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings)); #if defined(__USE_EX_HANDLERS) diff --git a/plugins/TabSRMM/src/include/controls.h b/plugins/TabSRMM/src/include/controls.h index ac4c0a3374..31eb0239cc 100644 --- a/plugins/TabSRMM/src/include/controls.h +++ b/plugins/TabSRMM/src/include/controls.h @@ -108,7 +108,7 @@ private: bool m_isAero; bool m_mustAutoHide; LONG m_size_y; - HANDLE m_hevHook; + /* * for custom drawing */ diff --git a/plugins/TabSRMM/src/include/globals.h b/plugins/TabSRMM/src/include/globals.h index 8b4955e454..071928c0af 100644 --- a/plugins/TabSRMM/src/include/globals.h +++ b/plugins/TabSRMM/src/include/globals.h @@ -201,7 +201,6 @@ public: TSplitterBroadCast lastSPlitterPos; TContainerSettings globalContainerSettings; - static HANDLE m_event_FoldersChanged; static TCHAR* m_default_container_name; static void cacheUpdateMetaChanged(); static void logStatusChange(WPARAM wParam, const CContactCache *c); @@ -212,12 +211,6 @@ public: static INT_PTR CALLBACK Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); private: bool m_TypingSoundAdded; - static HANDLE m_event_ModulesLoaded, m_event_PrebuildMenu, m_event_SettingChanged; - static HANDLE m_event_ContactDeleted, m_event_Dispatch, m_event_EventAdded; - static HANDLE m_event_IconsChanged, m_event_TypingEvent, m_event_ProtoAck, m_event_PreShutdown, m_event_OkToExit; - static HANDLE m_event_IcoLibChanged, m_event_AvatarChanged, m_event_MyAvatarChanged, m_event_FontsChanged; - static HANDLE m_event_SmileyAdd, m_event_IEView; - static HANDLE m_event_ME_MC_SUBCONTACTSCHANGED, m_event_ME_MC_FORCESEND, m_event_ME_MC_UNFORCESEND; static EXCEPTION_RECORD m_exRecord; static CONTEXT m_exCtx; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index b96f72b353..b254604484 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -324,7 +324,7 @@ void CMimAPI::configureCustomFolders() m_hChatLogsPath = FoldersRegisterCustomPathT("TabSRMM", "Group chat logs root", const_cast(getChatLogPath())); if (m_hDataPath) - CGlobals::m_event_FoldersChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, CMimAPI::FoldersPathChanged); + HookEvent(ME_FOLDERS_PATH_CHANGED, CMimAPI::FoldersPathChanged); foldersPathChanged(); } diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index ea4f8389fe..5eb4748c79 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -47,8 +47,6 @@ #include "commonheaders.h" -static HANDLE hEventCBButtonPressed,hEventCBInit, hEventDbOptionsInit, hEventDbPluginsLoaded; - int g_bStartup=0; BOOL g_bIMGtagButton; @@ -106,19 +104,6 @@ int ChangeClientIconInStatusBar(const TWindowData *dat) return (S_OK); } - -int ModPlus_PreShutdown(WPARAM wparam, LPARAM lparam) -{ - if ( hEventCBButtonPressed ) - UnhookEvent(hEventCBButtonPressed); - if ( hEventCBInit ) - UnhookEvent(hEventCBInit); - UnhookEvent(hEventDbPluginsLoaded); - UnhookEvent(hEventDbOptionsInit); - - return (0); -} - static int RegisterCustomButton(WPARAM wParam,LPARAM lParam) { if ( ServiceExists(MS_BB_ADDBUTTON)) { @@ -258,8 +243,8 @@ int ModPlus_Init(WPARAM wparam,LPARAM lparam) { g_bStartup = 1; - hEventCBButtonPressed=HookEvent(ME_MSG_BUTTONPRESSED,CustomButtonPressed); - hEventCBInit=HookEvent(ME_MSG_TOOLBARLOADED,RegisterCustomButton); + HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed); + HookEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton); if (PluginConfig.g_bClientInStatusBar&&ServiceExists(MS_MSG_ADDICON)) { StatusIconData sid = {0}; -- cgit v1.2.3