Skip to content

#2303 An error occured while trying to connect to voice #2886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions indra/newview/llavataractions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,25 +285,18 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floate
make_ui_sound("UISndStartIM");
}

/* AD *TODO: Is this function needed any more?
I fixed it a bit(added check for canCall), but it appears that it is not used
anywhere. Maybe it should be removed?
// static
bool LLAvatarActions::isCalling(const LLUUID &id)
bool LLAvatarActions::canCall()
{
if (id.isNull() || !canCall())
{
return false;
}

LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
}*/
LLVoiceClient* voice_client = LLVoiceClient::getInstance();
return voice_client->voiceEnabled() && voice_client->isVoiceWorking();
}

//static
bool LLAvatarActions::canCall()
// static
bool LLAvatarActions::canCallTo(const LLUUID& id)
{
return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
LLVoiceClient* voice_client = LLVoiceClient::getInstance();
return voice_client->voiceEnabled() && voice_client->isVoiceWorking() && voice_client->getVoiceEnabled(id);
}

// static
Expand Down
9 changes: 3 additions & 6 deletions indra/newview/llavataractions.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,15 @@ class LLAvatarActions
static bool canBlock(const LLUUID& id);

/**
* Return true if the avatar is in a P2P voice call with a given user
* @return true if voice calls are available
*/
/* AD *TODO: Is this function needed any more?
I fixed it a bit(added check for canCall), but it appears that it is not used
anywhere. Maybe it should be removed?
static bool isCalling(const LLUUID &id);*/
static bool canCall();

/**
* @return true if call to the resident can be made
*/
static bool canCallTo(const LLUUID& id);

static bool canCall();
/**
* Invite avatar to a group.
*/
Expand Down
7 changes: 6 additions & 1 deletion indra/newview/llfloaterbump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LLFloaterBump::LLFloaterBump(const LLSD& key)
mCommitCallbackRegistrar.add("ShowAgentProfile", { boost::bind(&LLFloaterBump::showProfile, this), cb_info::UNTRUSTED_THROTTLE });
mCommitCallbackRegistrar.add("Avatar.InviteToGroup", { boost::bind(&LLFloaterBump::inviteToGroup, this), cb_info::UNTRUSTED_THROTTLE });
mCommitCallbackRegistrar.add("Avatar.Call", { boost::bind(&LLFloaterBump::startCall, this), cb_info::UNTRUSTED_BLOCK });
mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
mEnableCallbackRegistrar.add("Avatar.EnableCall", { boost::bind(&LLFloaterBump::canCall, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Avatar.AddFriend", { boost::bind(&LLFloaterBump::addFriend, this), cb_info::UNTRUSTED_THROTTLE });
mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this));
mCommitCallbackRegistrar.add("Avatar.Mute", { boost::bind(&LLFloaterBump::muteAvatar, this), cb_info::UNTRUSTED_BLOCK });
Expand Down Expand Up @@ -214,6 +214,11 @@ void LLFloaterBump::startCall()
LLAvatarActions::startCall(mItemUUID);
}

bool LLFloaterBump::canCall()
{
return LLAvatarActions::canCallTo(mItemUUID);
}

void LLFloaterBump::reportAbuse()
{
LLFloaterReporter::showFromAvatar(mItemUUID, "av_name");
Expand Down
1 change: 1 addition & 0 deletions indra/newview/llfloaterbump.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class LLFloaterBump

void startIM();
void startCall();
bool canCall();
void reportAbuse();
void showProfile();
void addFriend();
Expand Down
10 changes: 5 additions & 5 deletions indra/newview/llfloaterimcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,15 +1592,15 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
}
else if ("can_call" == item)
{
if (is_single_select)
{
return LLAvatarActions::canCallTo(single_id);
}
return LLAvatarActions::canCall();
}
else if ("can_open_voice_conversation" == item)
{
return is_single_select && LLAvatarActions::canCall();
}
else if ("can_open_voice_conversation" == item)
{
return is_single_select && LLAvatarActions::canCall();
return is_single_select && LLAvatarActions::canCallTo(single_id);
}
else if ("can_zoom_in" == item)
{
Expand Down
16 changes: 1 addition & 15 deletions indra/newview/llpanelprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)

resetData();

LLUUID avatar_id = getAvatarId();

bool own_profile = getSelfProfile();

mGroupList->setShowNone(!own_profile);
Expand Down Expand Up @@ -793,7 +791,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)

if (!own_profile)
{
mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : true);
updateOnlineStatus();
fillRightsData();
}
Expand Down Expand Up @@ -1214,17 +1211,6 @@ void LLPanelProfileSecondLife::changed(U32 mask)
}
}

// virtual, called by LLVoiceClient
void LLPanelProfileSecondLife::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
{
if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
{
return;
}

mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : true);
}

void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id)
{
if (avatar_id.notNull())
Expand Down Expand Up @@ -1502,7 +1488,7 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
}
else if (item_name == "voice_call")
{
return mVoiceStatus;
return LLAvatarActions::canCallTo(agent_id);
}
else if (item_name == "chat_history")
{
Expand Down
7 changes: 0 additions & 7 deletions indra/newview/llpanelprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "llpanel.h"
#include "llpanelavatar.h"
#include "llmediactrl.h"
#include "llvoiceclient.h"

// class LLPanelProfileClassifieds;
// class LLTabContainer;
Expand Down Expand Up @@ -70,7 +69,6 @@ class LLViewerFetchedTexture;
class LLPanelProfileSecondLife
: public LLPanelProfilePropertiesProcessorTab
, public LLFriendObserver
, public LLVoiceClientStatusObserver
{
public:
LLPanelProfileSecondLife();
Expand All @@ -89,10 +87,6 @@ class LLPanelProfileSecondLife
*/
void changed(U32 mask) override;

// Implements LLVoiceClientStatusObserver::onChange() to enable the call
// button when voice is available
void onChange(EStatusType status, const LLSD& channelInfo, bool proximal) override;

void setAvatarId(const LLUUID& avatar_id) override;

bool postBuild() override;
Expand Down Expand Up @@ -203,7 +197,6 @@ class LLPanelProfileSecondLife
LLHandle<LLFloater> mFloaterTexturePickerHandle;

bool mHasUnsavedDescriptionChanges;
bool mVoiceStatus;
bool mWaitingForImageUpload;
bool mAllowPublish;
bool mHideAge;
Expand Down
20 changes: 17 additions & 3 deletions indra/newview/llviewermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down
Loading