From d33047bde23ea629901a3477edd90f3e19c1a4db Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Fri, 18 Oct 2024 02:57:20 +0200 Subject: #2303 An error occured while trying to connect to voice --- indra/newview/llviewermenu.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 39213569a5..68c38c3692 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7808,15 +7808,29 @@ class LLAvatarSendIM : public view_listener_t class LLAvatarCall : public view_listener_t { + static LLVOAvatar* findAvatar() + { + return find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); + } + bool handleEvent(const LLSD& userdata) { - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if(avatar) + if (LLVOAvatar* avatar = findAvatar()) { LLAvatarActions::startCall(avatar->getID()); } return true; } + +public: + static bool isAvailable() + { + if (LLVOAvatar* avatar = findAvatar()) + { + return LLAvatarActions::canCallTo(avatar->getID()); + } + return LLAvatarActions::canCall(); + } }; namespace @@ -10075,7 +10089,7 @@ void initialize_menus() registrar.add("Avatar.ShowInspector", boost::bind(&handle_avatar_show_inspector)); view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM"); view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call", cb_info::UNTRUSTED_BLOCK); - enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall)); + enable.add("Avatar.EnableCall", boost::bind(&LLAvatarCall::isAvailable)); view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse", cb_info::UNTRUSTED_THROTTLE); view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile"); view_listener_t::addMenu(new LLAvatarTogglePicks(), "Avatar.TogglePicks"); -- cgit v1.2.3