diff options
-rw-r--r-- | include/m_protoint.h | 13 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 207560 -> 208066 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 203192 -> 203708 bytes | |||
-rw-r--r-- | protocols/Discord/src/menus.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_menus.cpp | 4 | ||||
-rw-r--r-- | protocols/Steam/src/steam_menus.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_menus.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/proto_interface.cpp | 16 |
10 files changed, 31 insertions, 14 deletions
diff --git a/include/m_protoint.h b/include/m_protoint.h index c4f58111a8..b36948c600 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -63,6 +63,14 @@ EXTERN_C MIR_APP_DLL(void) ProtoCreateServiceParam(PROTO_INTERFACE *pThis, const /////////////////////////////////////////////////////////////////////////////////////////
// interface declaration
+enum ProtoMenuItemType
+{
+ PROTO_MENU_REQ_AUTH,
+ PROTO_MENU_GRANT_AUTH,
+ PROTO_MENU_REVOKE_AUTH,
+ PROTO_MENU_LOAD_HISTORY
+};
+
struct MIR_APP_EXPORT PROTO_INTERFACE : public MZeroedObject
{
@@ -79,9 +87,6 @@ public: HANDLE m_hProtoIcon = 0; // icon to be displayed in the account manager
HNETLIBUSER m_hNetlibUser = 0; // network agent
HGENMENU m_hmiMainMenu = 0; // if protocol menus are displayed in the main menu, this is the root
- HGENMENU m_hmiReqAuth; // a menu item for /RequestAuth service
- HGENMENU m_hmiGrantAuth; // a menu item for /GrantAuth service
- HGENMENU m_hmiRevokeAuth; // a menu item for /RevokeAuth service
PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszUserName);
~PROTO_INTERFACE();
@@ -192,6 +197,8 @@ public: void WindowSubscribe(HWND hwnd);
void WindowUnsubscribe(HWND hwnd);
+ HGENMENU GetMenuItem(ProtoMenuItemType);
+
//////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex f4b3f25579..53816488ba 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 40aa710ac6..7b732bbcfe 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/protocols/Discord/src/menus.cpp b/protocols/Discord/src/menus.cpp index 434e99792b..3cc43fc6ab 100644 --- a/protocols/Discord/src/menus.cpp +++ b/protocols/Discord/src/menus.cpp @@ -110,7 +110,7 @@ int CDiscordProto::OnMenuPrebuild(WPARAM hContact, LPARAM) Menu_ShowItem(m_hMenuToggleSync, bIsGuild); if (!bIsGuild && getWord(hContact, "ApparentMode") != 0) - Menu_ShowItem(m_hmiReqAuth, true); + Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), true); if (getByte(hContact, "EnableSync")) Menu_ModifyItem(m_hMenuToggleSync, LPGENW("Disable sync"), Skin_GetIconHandle(SKINICON_CHAT_LEAVE)); diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index a0d96be1ca..d0ea71ac0a 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -35,8 +35,8 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool isGrantNeed = getByte(hContact, "Grant", 0) > 0;
bool isBlocked = getBool(hContact, "IsBlocked", false);
- Menu_ShowItem(m_hmiReqAuth, isCtrlPressed || isAuthNeed);
- Menu_ShowItem(m_hmiGrantAuth, isCtrlPressed || isGrantNeed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), isCtrlPressed || isAuthNeed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_GRANT_AUTH), isCtrlPressed || isGrantNeed);
Menu_ShowItem(ContactMenuItems[CMI_BLOCK], true);
Menu_ShowItem(ContactMenuItems[CMI_UNBLOCK], isCtrlPressed || isBlocked);
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index c2e3e997ae..b421cdc120 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -74,8 +74,8 @@ int CSteamProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
bool authNeeded = getBool(hContact, "Auth", 0);
- Menu_ShowItem(m_hmiReqAuth, authNeeded || ctrlPressed);
- Menu_ShowItem(m_hmiRevokeAuth, !authNeeded || ctrlPressed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), authNeeded || ctrlPressed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_REVOKE_AUTH), !authNeeded || ctrlPressed);
bool isBlocked = getBool(hContact, "Block", 0);
Menu_ShowItem(contactMenuItems[CMI_BLOCK], !isBlocked || ctrlPressed);
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 2ea767b0e4..761f8a1320 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -14,10 +14,10 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) bool isCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
bool isAuthNeed = getByte(hContact, "Auth", 0) > 0;
- Menu_ShowItem(m_hmiReqAuth, isCtrlPressed || isAuthNeed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), isCtrlPressed || isAuthNeed);
bool isGrantNeed = getByte(hContact, "Grant", 0) > 0;
- Menu_ShowItem(m_hmiGrantAuth, isCtrlPressed || isGrantNeed);
+ Menu_ShowItem(GetMenuItem(PROTO_MENU_GRANT_AUTH), isCtrlPressed || isGrantNeed);
return 0;
}
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() {} |