diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-21 19:28:32 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-21 19:28:32 +0000 |
commit | 0d6aa760cd3262bcee3564b053192f959f176cf1 (patch) | |
tree | 0da98e03abf4fe89b7dc63e33d4ddce9fe784370 /plugins/MenuItemEx/src | |
parent | c09558a93578bd68aa30f3eee87babf5c92c3775 (diff) |
hooking loading/unloading popups plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3674 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MenuItemEx/src')
-rw-r--r-- | plugins/MenuItemEx/src/main.cpp | 46 | ||||
-rw-r--r-- | plugins/MenuItemEx/src/options.cpp | 3 |
2 files changed, 30 insertions, 19 deletions
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 5a62b68210..b2fe2224e7 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -23,7 +23,7 @@ HGENMENU hmenuVis,hmenuOff,hmenuHide,hmenuIgnore,hmenuProto,hmenuAdded,hmenuAuth HGENMENU hmenuCopyID,hmenuRecvFiles,hmenuStatusMsg,hmenuCopyIP,hmenuCopyMirVer;
static HANDLE hIgnoreItem[9], hProtoItem[MAX_PROTOS];
HICON hIcon[5];
-BOOL bMetaContacts;
+BOOL bMetaContacts, bPopUpService = FALSE;
PROTOACCOUNT **accs;
OPENOPTIONSDIALOG ood;
int protoCount;
@@ -707,7 +707,7 @@ INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) strcpy(buffer, szID);
CopyToClipboard((HWND)lparam, buffer, 0);
- if(CTRL_IS_PRESSED && ServiceExists(MS_POPUP_ADDPOPUP))
+ if(CTRL_IS_PRESSED && bPopUpService)
ShowPopup(buffer, 0, hContact);
return 0;
@@ -751,7 +751,7 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) }
CopyToClipboard((HWND)lparam, 0, buffer);
- if(CTRL_IS_PRESSED && ServiceExists(MS_POPUP_ADDPOPUP))
+ if(CTRL_IS_PRESSED && bPopUpService)
ShowPopup(0, buffer, (HANDLE)wparam);
return 0;
@@ -765,7 +765,7 @@ INT_PTR onCopyIP(WPARAM wparam,LPARAM lparam) getIP((HANDLE)wparam,szProto,(LPSTR)&szIP);
CopyToClipboard((HWND)lparam, szIP, 0);
- if(CTRL_IS_PRESSED && ServiceExists(MS_POPUP_ADDPOPUP))
+ if(CTRL_IS_PRESSED && bPopUpService)
ShowPopup(szIP, 0, (HANDLE)wparam);
return 0;
@@ -776,7 +776,7 @@ INT_PTR onCopyMirVer(WPARAM wparam,LPARAM lparam) LPSTR msg = getMirVer((HANDLE)wparam);
if(msg) {
CopyToClipboard((HWND)lparam, msg, 0);
- if(CTRL_IS_PRESSED && ServiceExists(MS_POPUP_ADDPOPUP))
+ if(CTRL_IS_PRESSED && bPopUpService)
ShowPopup(msg, 0, (HANDLE)wparam);
mir_free(msg);
@@ -1147,6 +1147,12 @@ static int ContactSettingChanged( WPARAM wParam, LPARAM lParam ) return 0;
}
+static int ModuleLoad(WPARAM wParam, LPARAM lParam)
+{
+ bPopUpService = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
+ return 0;
+}
+
// called when all modules are loaded
static int PluginInit(WPARAM wparam,LPARAM lparam)
{
@@ -1157,18 +1163,20 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0;
- CreateServiceFunction(MS_SETINVIS,onSetInvis);
- CreateServiceFunction(MS_SETVIS,onSetVis);
- CreateServiceFunction(MS_HIDE,onHide);
- CreateServiceFunction(MS_IGNORE,onIgnore);
- CreateServiceFunction(MS_PROTO,onChangeProto);
- CreateServiceFunction(MS_ADDED,onSendAdded);
- CreateServiceFunction(MS_AUTHREQ,onSendAuthRequest);
- CreateServiceFunction(MS_COPYID,onCopyID);
- CreateServiceFunction(MS_RECVFILES,onRecvFiles);
- CreateServiceFunction(MS_STATUSMSG,onCopyStatusMsg);
- CreateServiceFunction(MS_COPYIP,onCopyIP);
- CreateServiceFunction(MS_COPYMIRVER,onCopyMirVer);
+ CreateServiceFunction(MS_SETINVIS, onSetInvis);
+ CreateServiceFunction(MS_SETVIS, onSetVis);
+ CreateServiceFunction(MS_HIDE, onHide);
+ CreateServiceFunction(MS_IGNORE, onIgnore);
+ CreateServiceFunction(MS_PROTO, onChangeProto);
+ CreateServiceFunction(MS_ADDED, onSendAdded);
+ CreateServiceFunction(MS_AUTHREQ, onSendAuthRequest);
+ CreateServiceFunction(MS_COPYID, onCopyID);
+ CreateServiceFunction(MS_RECVFILES, onRecvFiles);
+ CreateServiceFunction(MS_STATUSMSG, onCopyStatusMsg);
+ CreateServiceFunction(MS_COPYIP, onCopyIP);
+ CreateServiceFunction(MS_COPYMIRVER, onCopyMirVer);
+
+ ModuleLoad(0, 0);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR;
@@ -1286,7 +1294,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
- HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
return 0;
}
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 1232d22450..9b9fadc838 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -2,6 +2,7 @@ extern HINSTANCE hinstance;
+extern BOOL bPopUpService;
struct {
int idc;
@@ -45,7 +46,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED);
}
- if (ServiceExists(MS_POPUP_ADDPOPUP))
+ if (bPopUpService)
{
for (i = 0; i < 4; i++)
{
|