summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_menus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-09 16:13:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-09 16:13:50 +0300
commitd15bd517fb0eb4bbdb1b118b44398b00bc8f6d6a (patch)
treeead9ec16a070ed6237975fe00a368fec2491e1ad /protocols/Tox/src/tox_menus.cpp
parentb407cbb7ad5cf00f0420fd91b82969ffcbaba5b5 (diff)
all duplicate "Request auth", "Grant auth" & "Revoke auth" menu items eliminated
Diffstat (limited to 'protocols/Tox/src/tox_menus.cpp')
-rw-r--r--protocols/Tox/src/tox_menus.cpp43
1 files changed, 6 insertions, 37 deletions
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index 5694689e1a..9dc0ee8b79 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -1,9 +1,12 @@
#include "stdafx.h"
-HGENMENU CToxProto::ContactMenuItems[CMI_MAX];
+// HGENMENU CToxProto::ContactMenuItems[CMI_MAX];
int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
{
+ // for (auto &it : ContactMenuItems)
+ // Menu_ShowItem(it, false);
+
if (!hContact)
return 0;
@@ -16,48 +19,14 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
bool isCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
bool isAuthNeed = getByte(hContact, "Auth", 0) > 0;
- Menu_ShowItem(ContactMenuItems[CMI_AUTH_REQUEST], isCtrlPressed || isAuthNeed);
+ Menu_ShowItem(m_hmiReqAuth, isCtrlPressed || isAuthNeed);
bool isGrantNeed = getByte(hContact, "Grant", 0) > 0;
- Menu_ShowItem(ContactMenuItems[CMI_AUTH_GRANT], isCtrlPressed || isGrantNeed);
+ Menu_ShowItem(m_hmiGrantAuth, isCtrlPressed || isGrantNeed);
return 0;
}
-int CToxProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
-{
- for (auto &it : ContactMenuItems)
- Menu_ShowItem(it, FALSE);
- CToxProto *proto = CToxProto::GetContactAccount(hContact);
- return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
-}
-
-void CToxProto::InitContactMenu()
-{
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::PrebuildContactMenu);
-
- CMenuItem mi;
- mi.flags = CMIF_UNICODE;
-
- // Request authorization
- SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e);
- mi.pszService = MODULE"/RequestAuth";
- mi.name.w = LPGENW("Request authorization");
- mi.position = CMI_POSITION + CMI_AUTH_REQUEST;
- mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_REQUEST);
- ContactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, GlobalService<&CToxProto::OnRequestAuth>);
-
- // Grant authorization
- SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30);
- mi.pszService = MODULE"/GrantAuth";
- mi.name.w = LPGENW("Grant authorization");
- mi.position = CMI_POSITION + CMI_AUTH_GRANT;
- mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT);
- ContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, GlobalService<&CToxProto::OnGrantAuth>);
-}
-
int CToxProto::UpdateStatusMenu(WPARAM, LPARAM)
{
bool isOnline = IsOnline();