diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-22 05:15:11 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-22 05:15:11 +0000 |
commit | aaa6c50016843a86c250d4c7725f626b340c7aad (patch) | |
tree | 9010e5c0393632933af09b16215d8f578b135324 | |
parent | 26fcb2d02ed4d1e295968d46ebdff67665f5192c (diff) |
hooking loading/unloading events
git-svn-id: http://svn.miranda-ng.org/main/trunk@3678 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/ClientChangeNotify/src/ClientChangeNotify.cpp | 13 | ||||
-rw-r--r-- | plugins/ClientChangeNotify/src/Common.h | 1 | ||||
-rw-r--r-- | plugins/ClientChangeNotify/src/Misc.h | 4 | ||||
-rw-r--r-- | plugins/ClientChangeNotify/src/OptDlg.cpp | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 75c6523d15..71748f8cbe 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -25,6 +25,7 @@ HANDLE g_hTogglePopupsMenuItem; int hLangpack;
TMyArray<HANDLE> hHooks, hServices;
COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview)
+BOOL bPopupExists = FALSE;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -335,7 +336,7 @@ static INT_PTR srvTogglePopups(WPARAM wParam, LPARAM lParam) static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam)
{
// we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded
- if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (bPopupExists) {
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR | CMIM_NAME | CMIM_ICON;
if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) {
@@ -372,6 +373,12 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM return 0;
}
+static int ModuleLoad(WPARAM wParam, LPARAM lParam)
+{
+ bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
+ return 0;
+}
+
int MirandaLoaded(WPARAM wParam, LPARAM lParam)
{
InitPcre();
@@ -379,12 +386,14 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) PopupOptPage.DBToMem();
RecompileRegexps(*(TCString*)PopupOptPage.GetValue(IDC_POPUPOPTDLG_IGNORESTRINGS));
hHooks.AddElem(HookEvent(ME_OPT_INITIALISE, OptionsDlgInit));
+ hHooks.AddElem(HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad));
+ hHooks.AddElem(HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad));
hHooks.AddElem(HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged));
hHooks.AddElem(HookEvent(ME_CONTACTSETTINGS_INITIALISE, ContactSettingsInit));
SkinAddNewSoundEx(CLIENTCHANGED_SOUND, NULL, LPGEN("ClientChangeNotify: Client changed"));
- if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ if (bPopupExists) {
hServices.AddElem(CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups));
hHooks.AddElem(HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu));
diff --git a/plugins/ClientChangeNotify/src/Common.h b/plugins/ClientChangeNotify/src/Common.h index 478c982bbf..14bed96102 100644 --- a/plugins/ClientChangeNotify/src/Common.h +++ b/plugins/ClientChangeNotify/src/Common.h @@ -105,6 +105,7 @@ #define CLIENTCHANGED_SOUND "ClientChanged"
extern HINSTANCE g_hInstance;
+extern BOOL bPopupExists;
extern COptPage g_PopupOptPage;
extern COptPage *g_PreviewOptPage;
diff --git a/plugins/ClientChangeNotify/src/Misc.h b/plugins/ClientChangeNotify/src/Misc.h index 262193dc26..55bf91cfdf 100644 --- a/plugins/ClientChangeNotify/src/Misc.h +++ b/plugins/ClientChangeNotify/src/Misc.h @@ -18,11 +18,11 @@ */
#include "Common.h"
-
+extern BOOL bPopupExists;
__inline void ShowMsg(TCHAR *FirstLine, TCHAR *SecondLine = _T(""), bool IsErrorMsg = false, int Timeout = 0)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPEX))
+ if (bPopupExists)
{
POPUPDATAT ppd = {0};
ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION);
diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 4a348a3d8b..42cbacca9b 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -172,7 +172,7 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int OptionsDlgInit(WPARAM wParam, LPARAM lParam)
{
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
+ if (bPopupExists) {
OPTIONSDIALOGPAGE optDi = {0};
optDi.cbSize = sizeof(optDi);
optDi.position = 920000000;
|