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/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 +------- 8 files changed, 30 insertions(+), 100 deletions(-) (limited to 'plugins/TabSRMM') 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