From d9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Tue, 5 Mar 2019 21:10:22 +0300
Subject: Popup:

- wiping out checks for service presence;
- code cleaning
---
 plugins/MenuItemEx/src/main.cpp    | 19 ++++---------------
 plugins/MenuItemEx/src/options.cpp | 16 +++++-----------
 2 files changed, 9 insertions(+), 26 deletions(-)

(limited to 'plugins/MenuItemEx/src')

diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index b96e3cdd2b..a988fb13ef 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -18,7 +18,6 @@ HGENMENU hmenuVis, hmenuOff, hmenuHide, hmenuIgnore, hmenuProto;
 HGENMENU hmenuCopyID, hmenuRecvFiles, hmenuStatusMsg, hmenuCopyIP, hmenuCopyMirVer;
 static HGENMENU hIgnoreItem[9], hProtoItem[MAX_PROTOS];
 HICON hIcons[5];
-BOOL bPopupService = FALSE;
 PROTOACCOUNT **accs;
 int protoCount;
 CMPlugin g_plugin;
@@ -514,7 +513,7 @@ static INT_PTR onCopyID(WPARAM hContact, LPARAM)
 	else wcsncpy_s(buffer, szID, _TRUNCATE);
 
 	CopyToClipboard(buffer);
-	if (CTRL_IS_PRESSED && bPopupService)
+	if (CTRL_IS_PRESSED)
 		ShowPopup(buffer, hContact);
 
 	return 0;
@@ -550,7 +549,7 @@ static INT_PTR onCopyStatusMsg(WPARAM hContact, LPARAM)
 	}
 
 	CopyToClipboard(wszBuffer);
-	if (CTRL_IS_PRESSED && bPopupService)
+	if (CTRL_IS_PRESSED)
 		ShowPopup(wszBuffer, hContact);
 
 	return 0;
@@ -570,7 +569,7 @@ static INT_PTR onCopyIP(WPARAM hContact, LPARAM)
 		wszBuffer.AppendFormat(L"Internal IP: %d.%d.%d.%d\r\n", rIP >> 24, (rIP >> 16) & 0xFF, (rIP >> 8) & 0xFF, rIP & 0xFF);
 
 	CopyToClipboard(wszBuffer);
-	if (CTRL_IS_PRESSED && bPopupService)
+	if (CTRL_IS_PRESSED)
 		ShowPopup(wszBuffer, hContact);
 
 	return 0;
@@ -581,7 +580,7 @@ static INT_PTR onCopyMirVer(WPARAM hContact, LPARAM)
 	LPWSTR msg = getMirVer(hContact);
 	if (msg) {
 		CopyToClipboard(msg);
-		if (CTRL_IS_PRESSED && bPopupService)
+		if (CTRL_IS_PRESSED)
 			ShowPopup(msg, hContact);
 
 		mir_free(msg);
@@ -844,19 +843,11 @@ static int ContactWindowOpen(WPARAM, LPARAM lParam)
 	return 0;
 }
 
-static int ModuleLoad(WPARAM, LPARAM)
-{
-	bPopupService = ServiceExists(MS_POPUP_ADDPOPUPW);
-	return 0;
-}
-
 // called when all modules are loaded
 static int PluginInit(WPARAM, LPARAM)
 {
 	int pos = 1000;
 
-	ModuleLoad(0, 0);
-
 	CMenuItem mi(&g_plugin);
 	mi.flags = CMIF_UNICODE;
 
@@ -967,8 +958,6 @@ int CMPlugin::Load()
 	CreateServiceFunction(MS_OPENIGNORE, OpenIgnoreOptions);
 
 	HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit);
-	HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
-	HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
 	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, BuildMenu);
 	HookEvent(ME_OPT_INITIALISE, OptionsInit);
 	HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu);
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp
index 2fc76947a7..203ee9669d 100644
--- a/plugins/MenuItemEx/src/options.cpp
+++ b/plugins/MenuItemEx/src/options.cpp
@@ -1,7 +1,5 @@
 #include "stdafx.h"
 
-extern BOOL bPopupService;
-
 struct {
 	int idc;
 	int flag;
@@ -78,16 +76,12 @@ public:
 			item.SetState(m_flags & it.flag);
 		}
 
-		if (bPopupService) {
-			for (int i = 0; i < 4; i++) {
-				CCtrlCheck &item = *(CCtrlCheck*)FindControl(checkboxes[i].idc);
-				CMStringW buffer;
-				buffer.Format(L"%s *", item.GetText());
-				item.SetText(buffer);
-			}
+		for (int i = 0; i < 4; i++) {
+			CCtrlCheck &item = *(CCtrlCheck*)FindControl(checkboxes[i].idc);
+			CMStringW buffer;
+			buffer.Format(L"%s *", item.GetText());
+			item.SetText(buffer);
 		}
-		else
-			m_lblHint.Hide();
 
 		EnableWindowChecks();
 		return true;
-- 
cgit v1.2.3