From 1f59d862f624b14135eaf16899d3bc617fa3ff1e Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 21 Feb 2013 12:07:26 +0000 Subject: hooking loading/unloading popups plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@3668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/icq_opts.cpp | 2 +- protocols/IcqOscarJ/src/icq_popups.cpp | 10 +--------- protocols/IcqOscarJ/src/icq_popups.h | 3 +-- protocols/IcqOscarJ/src/icq_proto.cpp | 2 +- protocols/IcqOscarJ/src/init.cpp | 10 ++++++++++ 5 files changed, 14 insertions(+), 13 deletions(-) (limited to 'protocols/IcqOscarJ') diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 3210593753..e43d1dc719 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -606,7 +606,7 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcIcqPrivacyOpts; Options_AddPage(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUP)) { + if (bPopUpService) { odp.position = 100000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS); odp.groupPosition = 900000000; diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index 1420cd4365..cee5509a7c 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -29,15 +29,7 @@ // ----------------------------------------------------------------------------- #include "icqoscar.h" -BOOL bPopUpService = FALSE; - -void InitPopUps() -{ - if (ServiceExists(MS_POPUP_ADDPOPUPEX)) - { - bPopUpService = TRUE; - } -} +extern BOOL bPopUpService; static const UINT icqPopupsControls[] = { IDC_POPUPS_LOG_ENABLED, IDC_POPUPS_SPAM_ENABLED, IDC_PREVIEW, IDC_USESYSICONS, IDC_POPUP_LOG0_TIMEOUT, diff --git a/protocols/IcqOscarJ/src/icq_popups.h b/protocols/IcqOscarJ/src/icq_popups.h index a42c230634..95e997a826 100644 --- a/protocols/IcqOscarJ/src/icq_popups.h +++ b/protocols/IcqOscarJ/src/icq_popups.h @@ -33,8 +33,7 @@ #define POPTYPE_SPAM 254 // this is for spambots - -void InitPopUps(); +int ModuleLoad(WPARAM, LPARAM); void InitPopupOpts(WPARAM wParam); diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 2b8293ef0a..ceb9363eb8 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -311,7 +311,7 @@ int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam ) InitAvatars(); // Init extra optional modules - InitPopUps(); + ModuleLoad(0, 0); InitXStatusItems(FALSE); HANDLE hContact = FindFirstContact(); diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 2489646844..45bbc15bec 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -35,6 +35,7 @@ HINSTANCE hInst; int hLangpack; CLIST_INTERFACE *pcli; +BOOL bPopUpService = FALSE; HANDLE hExtraXStatus; @@ -88,6 +89,12 @@ IconItem g_IconsList[4] = { LPGEN("Add to server list"), "add_to_server", IDI_SERVLIST_ADD } }; +int ModuleLoad(WPARAM wParam, LPARAM lParam) +{ + bPopUpService = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0; + return 0; +} + extern "C" int __declspec(dllexport) Load(void) { mir_getLP( &pluginInfo ); @@ -118,6 +125,9 @@ extern "C" int __declspec(dllexport) Load(void) InitXStatusIcons(); HookEvent(ME_SKIN2_ICONSCHANGED, OnReloadIcons); + HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); + HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); + hExtraXStatus = ExtraIcon_Register("xstatus", "ICQ XStatus", "icq_xstatus13"); g_MenuInit(); -- cgit v1.2.3