From 4b69fe94b6b6883a5b92379f9a2e97fbab184ebd Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 21 Feb 2013 10:14:43 +0000 Subject: fixed deleting popups options page when loading/unloading popup or yapp plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@3662 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdchat/src/options.cpp | 2 +- src/core/stdchat/src/services.cpp | 30 ++++++++++++++++++++++++++---- src/core/stdchat/src/tools.cpp | 1 - 3 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 678c4dfbda..8ad41172ce 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -922,7 +922,7 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcOptions2; Options_AddPage(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUP)) { + if (PopUpInstalled) { odp.position = 910000002; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP); odp.pszTitle = LPGEN("Chat"); diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp index 98167b2306..797b729c5b 100644 --- a/src/core/stdchat/src/services.cpp +++ b/src/core/stdchat/src/services.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_fontservice.h" -extern HICON hIcons[30]; +extern HICON hIcons[30]; extern HIMAGELIST hImageList; extern HIMAGELIST hIconsList; extern BOOL SmileyAddInstalled; @@ -34,8 +34,10 @@ extern BOOL IEviewInstalled; HANDLE hSendEvent; HANDLE hBuildMenuEvent ; HANDLE g_hModulesLoaded; +HANDLE g_hModuleLoad; +HANDLE g_hModuleUnload; HANDLE g_hSystemPreShutdown; -HANDLE hJoinMenuItem, hLeaveMenuItem; +HANDLE hJoinMenuItem, hLeaveMenuItem; HANDLE g_hHookPrebuildMenu; HANDLE g_hIconsChanged, g_hFontsChanged; HANDLE g_hSmileyOptionsChanged = NULL; @@ -243,14 +245,14 @@ static int ModulesLoaded(WPARAM wParam,LPARAM lParam) SmileyAddInstalled = TRUE; g_hSmileyOptionsChanged = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged); } - if ( ServiceExists( MS_POPUP_ADDPOPUPEX )) + if ( ServiceExists(MS_POPUP_ADDPOPUPEX)) PopUpInstalled = TRUE; if ( ServiceExists( MS_IEVIEW_WINDOW )) IEviewInstalled = TRUE; CList_SetAllOffline(TRUE, NULL); - return 0; + return 0; } static INT_PTR Service_GetCount(WPARAM wParam,LPARAM lParam) @@ -790,6 +792,22 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) return 0; } +static int ModuleLoad(WPARAM wParam, LPARAM lParam) +{ + PLUGININFOEX* pluginInfo = (PLUGININFOEX*)wParam; + if (!stricmp(pluginInfo->shortName, "popup plus") || !stricmp(pluginInfo->shortName, "yapp")) + PopUpInstalled = TRUE; + return 0; +} + +static int ModuleUnload(WPARAM wParam, LPARAM lParam) +{ + PLUGININFOEX* pluginInfo = (PLUGININFOEX*)wParam; + if (!stricmp(pluginInfo->shortName, "popup plus") || !stricmp(pluginInfo->shortName, "yapp")) + PopUpInstalled = FALSE; + return 0; +} + ///////////////////////////////////////////////////////////////////////////////////////// // Service creation @@ -797,6 +815,8 @@ void HookEvents(void) { InitializeCriticalSection(&cs); g_hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + g_hModuleLoad = HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); + g_hModuleUnload = HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleUnload); g_hHookPrebuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu); g_hSystemPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); g_hIconsChanged = HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); @@ -805,6 +825,8 @@ void HookEvents(void) void UnhookEvents(void) { UnhookEvent(g_hModulesLoaded); + UnhookEvent(g_hModuleLoad); + UnhookEvent(g_hModuleUnload); UnhookEvent(g_hSystemPreShutdown); UnhookEvent(g_hHookPrebuildMenu); UnhookEvent(g_hIconsChanged); diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 2d3c185859..cc16567268 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" extern HICON hIcons[30]; -extern BOOL PopUpInstalled; extern FONTINFO aFonts[OPTIONS_FONTCOUNT]; extern HMENU g_hMenu; extern HANDLE hBuildMenuEvent ; -- cgit v1.2.3