From 40a156173e722aaf0c9d454ac573f0a26338e065 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 8 Aug 2017 12:26:17 +0300 Subject: ME_MSG_TOOLBARLOADED is hooked everywhere as a temporary event --- plugins/BossKeyPlus/src/BossKey.cpp | 3 ++- plugins/CloudFile/src/events.cpp | 6 +++--- plugins/MenuItemEx/src/main.cpp | 8 +++----- plugins/MirOTR/src/svcs_srmm.cpp | 3 ++- plugins/Nudge/src/main.cpp | 7 +++---- plugins/QuickMessages/src/main.cpp | 3 ++- plugins/Scriver/src/msgs.cpp | 3 ++- plugins/SmileyAdd/src/main.cpp | 4 ++-- plugins/TabSRMM/src/buttonsbar.cpp | 2 +- plugins/TabSRMM/src/modplus.cpp | 3 ++- src/core/stdmsg/src/msgs.cpp | 3 ++- 11 files changed, 24 insertions(+), 21 deletions(-) diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index f9e01c480e..02e0ac70de 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -634,9 +634,10 @@ int MirandaLoaded(WPARAM, LPARAM) HookEvent(ME_OPT_INITIALISE, OptsDlgInit); HookEvent(ME_MSG_WINDOWEVENT, MsgWinOpening); HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtos); - HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit); HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit); + GetWindowThreadProcessId(pcli->hwndContactList, &g_dwMirandaPID); WNDCLASS winclass = { 0 }; diff --git a/plugins/CloudFile/src/events.cpp b/plugins/CloudFile/src/events.cpp index 248397b8f4..33e0419603 100644 --- a/plugins/CloudFile/src/events.cpp +++ b/plugins/CloudFile/src/events.cpp @@ -11,13 +11,13 @@ int OnModulesLoaded(WPARAM, LPARAM) HookEventObj(ME_FILEDLG_CANCELED, OnFileDialogCanceled, service); } - // menus + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); - // srmm - HookEvent(ME_MSG_TOOLBARLOADED, OnSrmmToolbarLoaded); + HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowOpened); HookEvent(ME_MSG_BUTTONPRESSED, OnSrmmButtonPressed); + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, OnSrmmToolbarLoaded); return 0; } diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 2872e57272..89882ab574 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -1038,11 +1038,9 @@ static int PluginInit(WPARAM, LPARAM) hIcons[3] = MakeHalfAlphaIcon(hIcons[1]); hIcons[4] = MakeHalfAlphaIcon(hIcons[2]); - if (HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit)) { - HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); - HookEvent(ME_MSG_WINDOWEVENT, ContactWindowOpen); - } - + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit); + HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); + HookEvent(ME_MSG_WINDOWEVENT, ContactWindowOpen); return 0; } diff --git a/plugins/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/src/svcs_srmm.cpp index 785556dfcf..f0d23e5357 100644 --- a/plugins/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/src/svcs_srmm.cpp @@ -138,8 +138,9 @@ void InitSRMM() OTRButton.pwszTooltip = TranslateT(LANG_OTR_TOOLTIP); OTRButton.hIcon = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); - HookEvent(ME_MSG_TOOLBARLOADED, SVC_ButtonsBarLoaded); HookEvent(ME_MSG_BUTTONPRESSED, SVC_ButtonsBarPressed); + + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, SVC_ButtonsBarLoaded); } void DeinitSRMM() diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index b710f2868a..a956df53bd 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -302,10 +302,9 @@ int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); - if (HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonInit)) { - HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); - HookEvent(ME_MSG_WINDOWEVENT, ContactWindowOpen); - } + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonInit); + HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); + HookEvent(ME_MSG_WINDOWEVENT, ContactWindowOpen); return 0; } diff --git a/plugins/QuickMessages/src/main.cpp b/plugins/QuickMessages/src/main.cpp index 3e2b651217..c889776178 100644 --- a/plugins/QuickMessages/src/main.cpp +++ b/plugins/QuickMessages/src/main.cpp @@ -256,9 +256,10 @@ static int PluginInit(WPARAM, LPARAM) g_bStartup = 1; HookEvent(ME_OPT_INITIALISE, OptionsInit); HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed); - HookEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton); HookEvent(ME_MSG_WINDOWPOPUP, InputMenuPopup); + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton); + g_bRClickAuto = db_get_b(NULL, PLGNAME, "RClickAuto", 0); g_bLClickAuto = db_get_b(NULL, PLGNAME, "LClickAuto", 0); g_iButtonsCount = db_get_b(NULL, PLGNAME, "ButtonsCount", 0); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 617619f89f..58d97fbf1e 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -597,9 +597,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); HookEvent(ME_FONT_RELOAD, FontServiceFontsChanged); HookEvent(ME_MSG_ICONPRESSED, StatusIconPressed); - HookEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons); HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactChanged); + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons); + RestoreUnreadMessageAlerts(); RegisterStatusIcons(); return 0; diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 38d1380068..81c3c9bb19 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -113,9 +113,9 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_PROTO_ACCLISTCHANGED, AccountListChanged); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DbSettingChanged); HookEvent(ME_COLOUR_RELOAD, ReloadColour); - HookEvent(ME_MSG_BUTTONPRESSED, SmileyButtonPressed); - HookEvent(ME_MSG_TOOLBARLOADED, SmileyButtonCreate); + + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, SmileyButtonCreate); // create the smiley services CreateServiceFunction(MS_SMILEYADD_REPLACESMILEYS, ReplaceSmileysCommand); diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 43f8cb8f44..c91d7d92fc 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -379,5 +379,5 @@ void CTabBaseDlg::CB_ChangeButton(CustomButtonData *cbd) void CB_InitCustomButtons() { - HookEvent(ME_MSG_TOOLBARLOADED, CB_InitDefaultButtons); + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, CB_InitDefaultButtons); } diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 05d1edd95f..3bde72a450 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -137,6 +137,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) int ModPlus_Init() { HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed); - HookEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton); + + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, RegisterCustomButton); return 0; } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 15d1800da0..bffa4588be 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -436,7 +436,8 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) hMsgMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_FONT_RELOAD, FontsChanged); - HookEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons); + + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, RegisterToolbarIcons); RestoreUnreadMessageAlerts(); return 0; -- cgit v1.2.3