From 61884f90293ee814791f0594d4388a8244b3511e Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Mon, 29 Jun 2020 18:50:53 +0300
Subject: PROTO_INTERFACE::GetMenuItem - unified access to all protocol menu
 items

---
 src/mir_app/src/mir_app.def         |  1 +
 src/mir_app/src/mir_app64.def       |  1 +
 src/mir_app/src/proto_interface.cpp | 16 ++++++++++++----
 3 files changed, 14 insertions(+), 4 deletions(-)

(limited to 'src/mir_app')

diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 81f35ed7c4..608dd1e07b 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -739,3 +739,4 @@ Chat_CreateMenu @824 NONAME
 ?Proto_GetInstance@@YGPAUPROTO_INTERFACE@@PBD@Z @827 NONAME
 ?OnEventEdited@PROTO_INTERFACE@@UAEXII@Z @828 NONAME
 ?GetChecker@MDatabaseCommon@@UAGPAUMIDatabaseChecker@@XZ @829 NONAME
+?GetMenuItem@PROTO_INTERFACE@@QAEPAUTMO_IntMenuItem@@W4ProtoMenuItemType@@@Z @830 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 1d5ffc95a3..2e123cd123 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -739,3 +739,4 @@ Chat_CreateMenu @824 NONAME
 ?Proto_GetInstance@@YAPEAUPROTO_INTERFACE@@PEBD@Z @827 NONAME
 ?OnEventEdited@PROTO_INTERFACE@@UEAAXII@Z @828 NONAME
 ?GetChecker@MDatabaseCommon@@UEAAPEAUMIDatabaseChecker@@XZ @829 NONAME
+?GetMenuItem@PROTO_INTERFACE@@QEAAPEAUTMO_IntMenuItem@@W4ProtoMenuItemType@@@Z @830 NONAME
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp
index d72b71fb4c..1cc874c05f 100644
--- a/src/mir_app/src/proto_interface.cpp
+++ b/src/mir_app/src/proto_interface.cpp
@@ -35,10 +35,6 @@ PROTO_INTERFACE::PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszU
 	m_szModuleName = mir_strdup(pszModuleName);
 	m_tszUserName = mir_wstrdup(ptszUserName);
 	db_set_resident(m_szModuleName, "Status");
-
-	m_hmiReqAuth = hReqAuth;
-	m_hmiGrantAuth = hGrantAuth;
-	m_hmiRevokeAuth = hRevokeAuth;
 }
 
 PROTO_INTERFACE::~PROTO_INTERFACE()
@@ -52,6 +48,18 @@ PROTO_INTERFACE::~PROTO_INTERFACE()
 	WindowList_Destroy(m_hWindowList);
 }
 
+HGENMENU PROTO_INTERFACE::GetMenuItem(ProtoMenuItemType aType)
+{
+	switch (aType) {
+	case PROTO_MENU_REQ_AUTH: return hReqAuth;
+	case PROTO_MENU_GRANT_AUTH: return hGrantAuth;
+	case PROTO_MENU_REVOKE_AUTH: return hRevokeAuth;
+	case PROTO_MENU_LOAD_HISTORY: return hServerHist;
+	}
+
+	return nullptr;
+}
+
 void PROTO_INTERFACE::OnBuildProtoMenu()
 {}
 
-- 
cgit v1.2.3