From 12e979282a85e81261a8f5c4ea056433190391d6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 6 Aug 2022 16:45:23 +0300 Subject: fixes #3148 (Jabber: "Voice call"menu item should be hidden if the feature is disabled) --- protocols/JabberG/src/jabber_menu.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 808302b164..18dbc9d928 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -47,6 +47,7 @@ static HGENMENU g_hMenuSendNote; static HGENMENU g_hMenuResourcesRoot; static HGENMENU g_hMenuResourcesActive; static HGENMENU g_hMenuResourcesServer; +static HGENMENU g_hMenuVoiceCall; struct { @@ -121,6 +122,7 @@ static int JabberPrebuildContactMenu(WPARAM hContact, LPARAM lParam) Menu_ShowItem(g_hMenuAddBookmark, false); Menu_ShowItem(g_hMenuResourcesRoot, false); Menu_ShowItem(g_hMenuDirectPresence[0], false); + Menu_ShowItem(g_hMenuVoiceCall, false); CJabberProto *ppro = CMPlugin::getInstance(hContact); return(ppro) ? ppro->OnPrebuildContactMenu(hContact, lParam) : 0; @@ -260,7 +262,7 @@ void g_MenuInit(void) mi.name.a = LPGEN("Voice call"); mi.pszService = "Jabber/VOIPCallIinitiate"; mi.position = -1999902010; - Menu_AddContactMenuItem(&mi); + g_hMenuVoiceCall = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, JabberVOIPCallIinitiate); } @@ -284,13 +286,14 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) return 0; Menu_ShowItem(GetMenuItem(PROTO_MENU_LOAD_HISTORY), false); - bool bIsChatRoom = isChatRoom(hContact); - bool bIsTransport = getBool(hContact, "IsTransport", false); if (!m_bJabberOnline) return 0; - Menu_ShowItem(g_hMenuDirectPresence[0], TRUE); + bool bIsChatRoom = isChatRoom(hContact); + bool bIsTransport = getBool(hContact, "IsTransport", false); + + Menu_ShowItem(g_hMenuDirectPresence[0], true); for (int i = 0; i < _countof(PresenceModeArray); i++) Menu_ModifyItem(g_hMenuDirectPresence[i + 1], nullptr, Skin_GetProtoIcon(m_szModuleName, PresenceModeArray[i].mode)); @@ -301,17 +304,20 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) ptrA roomid(getUStringA(hContact, "ChatRoomID")); if (ListGetItemPtr(LIST_BOOKMARK, roomid) == nullptr) if (m_ThreadInfo && m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE) - Menu_ShowItem(g_hMenuAddBookmark, TRUE); + Menu_ShowItem(g_hMenuAddBookmark, true); } if (bIsChatRoom == GCW_CHATROOM) return 0; if (bIsTransport) { - Menu_ShowItem(g_hMenuLogin, TRUE); - Menu_ShowItem(g_hMenuRefresh, TRUE); + Menu_ShowItem(g_hMenuLogin, true); + Menu_ShowItem(g_hMenuRefresh, true); } + if (m_bEnableVOIP) + Menu_ShowItem(g_hMenuVoiceCall, true); + ptrA jid(getUStringA(hContact, "jid")); if (jid == nullptr) return 0; @@ -326,12 +332,12 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(GetMenuItem(PROTO_MENU_GRANT_AUTH), bCtrlPressed); Menu_ShowItem(GetMenuItem(PROTO_MENU_REVOKE_AUTH), item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed); Menu_ShowItem(g_hMenuCommands, ((jcb & JABBER_CAPS_COMMANDS) != 0) || bCtrlPressed); - Menu_ShowItem(g_hMenuSendNote, TRUE); + Menu_ShowItem(g_hMenuSendNote, true); if (item->arResources.getCount() == 0) return 0; - Menu_ShowItem(g_hMenuResourcesRoot, TRUE); + Menu_ShowItem(g_hMenuResourcesRoot, true); Menu_ModifyItem(g_hMenuResourcesRoot, nullptr, m_hProtoIcon); Menu_ModifyItem(g_hMenuResourcesActive, nullptr, m_hProtoIcon, (item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0); Menu_ModifyItem(g_hMenuResourcesServer, nullptr, m_hProtoIcon, (item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0); @@ -373,7 +379,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ModifyItem(m_phMenuResourceItems[i], szTmp, hIcon); DestroyIcon(hIcon); } - else Menu_ShowItem(m_phMenuResourceItems[i], FALSE); + else Menu_ShowItem(m_phMenuResourceItems[i], false); } m_nMenuResourceItems = nMenuResourceItemsNew; -- cgit v1.2.3