Skip to content

Commit d33047b

Browse files
committed
#2303 An error occured while trying to connect to voice
1 parent fc1c563 commit d33047b

8 files changed

+41
-52
lines changed

indra/newview/llavataractions.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,25 +285,18 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floate
285285
make_ui_sound("UISndStartIM");
286286
}
287287

288-
/* AD *TODO: Is this function needed any more?
289-
I fixed it a bit(added check for canCall), but it appears that it is not used
290-
anywhere. Maybe it should be removed?
291288
// static
292-
bool LLAvatarActions::isCalling(const LLUUID &id)
289+
bool LLAvatarActions::canCall()
293290
{
294-
if (id.isNull() || !canCall())
295-
{
296-
return false;
297-
}
298-
299-
LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id);
300-
return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
301-
}*/
291+
LLVoiceClient* voice_client = LLVoiceClient::getInstance();
292+
return voice_client->voiceEnabled() && voice_client->isVoiceWorking();
293+
}
302294

303-
//static
304-
bool LLAvatarActions::canCall()
295+
// static
296+
bool LLAvatarActions::canCallTo(const LLUUID& id)
305297
{
306-
return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
298+
LLVoiceClient* voice_client = LLVoiceClient::getInstance();
299+
return voice_client->voiceEnabled() && voice_client->isVoiceWorking() && voice_client->getVoiceEnabled(id);
307300
}
308301

309302
// static

indra/newview/llavataractions.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,15 @@ class LLAvatarActions
172172
static bool canBlock(const LLUUID& id);
173173

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

182179
/**
183180
* @return true if call to the resident can be made
184181
*/
182+
static bool canCallTo(const LLUUID& id);
185183

186-
static bool canCall();
187184
/**
188185
* Invite avatar to a group.
189186
*/

indra/newview/llfloaterbump.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ LLFloaterBump::LLFloaterBump(const LLSD& key)
5656
mCommitCallbackRegistrar.add("ShowAgentProfile", { boost::bind(&LLFloaterBump::showProfile, this), cb_info::UNTRUSTED_THROTTLE });
5757
mCommitCallbackRegistrar.add("Avatar.InviteToGroup", { boost::bind(&LLFloaterBump::inviteToGroup, this), cb_info::UNTRUSTED_THROTTLE });
5858
mCommitCallbackRegistrar.add("Avatar.Call", { boost::bind(&LLFloaterBump::startCall, this), cb_info::UNTRUSTED_BLOCK });
59-
mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
59+
mEnableCallbackRegistrar.add("Avatar.EnableCall", { boost::bind(&LLFloaterBump::canCall, this), cb_info::UNTRUSTED_BLOCK });
6060
mCommitCallbackRegistrar.add("Avatar.AddFriend", { boost::bind(&LLFloaterBump::addFriend, this), cb_info::UNTRUSTED_THROTTLE });
6161
mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this));
6262
mCommitCallbackRegistrar.add("Avatar.Mute", { boost::bind(&LLFloaterBump::muteAvatar, this), cb_info::UNTRUSTED_BLOCK });
@@ -214,6 +214,11 @@ void LLFloaterBump::startCall()
214214
LLAvatarActions::startCall(mItemUUID);
215215
}
216216

217+
bool LLFloaterBump::canCall()
218+
{
219+
return LLAvatarActions::canCallTo(mItemUUID);
220+
}
221+
217222
void LLFloaterBump::reportAbuse()
218223
{
219224
LLFloaterReporter::showFromAvatar(mItemUUID, "av_name");

indra/newview/llfloaterbump.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class LLFloaterBump
5252

5353
void startIM();
5454
void startCall();
55+
bool canCall();
5556
void reportAbuse();
5657
void showProfile();
5758
void addFriend();

indra/newview/llfloaterimcontainer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,15 +1592,15 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v
15921592
}
15931593
else if ("can_call" == item)
15941594
{
1595+
if (is_single_select)
1596+
{
1597+
return LLAvatarActions::canCallTo(single_id);
1598+
}
15951599
return LLAvatarActions::canCall();
15961600
}
15971601
else if ("can_open_voice_conversation" == item)
15981602
{
1599-
return is_single_select && LLAvatarActions::canCall();
1600-
}
1601-
else if ("can_open_voice_conversation" == item)
1602-
{
1603-
return is_single_select && LLAvatarActions::canCall();
1603+
return is_single_select && LLAvatarActions::canCallTo(single_id);
16041604
}
16051605
else if ("can_zoom_in" == item)
16061606
{

indra/newview/llpanelprofile.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key)
754754

755755
resetData();
756756

757-
LLUUID avatar_id = getAvatarId();
758-
759757
bool own_profile = getSelfProfile();
760758

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

794792
if (!own_profile)
795793
{
796-
mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(avatar_id) ? LLAvatarTracker::instance().isBuddyOnline(avatar_id) : true);
797794
updateOnlineStatus();
798795
fillRightsData();
799796
}
@@ -1214,17 +1211,6 @@ void LLPanelProfileSecondLife::changed(U32 mask)
12141211
}
12151212
}
12161213

1217-
// virtual, called by LLVoiceClient
1218-
void LLPanelProfileSecondLife::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
1219-
{
1220-
if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
1221-
{
1222-
return;
1223-
}
1224-
1225-
mVoiceStatus = LLAvatarActions::canCall() && (LLAvatarActions::isFriend(getAvatarId()) ? LLAvatarTracker::instance().isBuddyOnline(getAvatarId()) : true);
1226-
}
1227-
12281214
void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id)
12291215
{
12301216
if (avatar_id.notNull())
@@ -1502,7 +1488,7 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata)
15021488
}
15031489
else if (item_name == "voice_call")
15041490
{
1505-
return mVoiceStatus;
1491+
return LLAvatarActions::canCallTo(agent_id);
15061492
}
15071493
else if (item_name == "chat_history")
15081494
{

indra/newview/llpanelprofile.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "llpanel.h"
3434
#include "llpanelavatar.h"
3535
#include "llmediactrl.h"
36-
#include "llvoiceclient.h"
3736

3837
// class LLPanelProfileClassifieds;
3938
// class LLTabContainer;
@@ -70,7 +69,6 @@ class LLViewerFetchedTexture;
7069
class LLPanelProfileSecondLife
7170
: public LLPanelProfilePropertiesProcessorTab
7271
, public LLFriendObserver
73-
, public LLVoiceClientStatusObserver
7472
{
7573
public:
7674
LLPanelProfileSecondLife();
@@ -89,10 +87,6 @@ class LLPanelProfileSecondLife
8987
*/
9088
void changed(U32 mask) override;
9189

92-
// Implements LLVoiceClientStatusObserver::onChange() to enable the call
93-
// button when voice is available
94-
void onChange(EStatusType status, const LLSD& channelInfo, bool proximal) override;
95-
9690
void setAvatarId(const LLUUID& avatar_id) override;
9791

9892
bool postBuild() override;
@@ -203,7 +197,6 @@ class LLPanelProfileSecondLife
203197
LLHandle<LLFloater> mFloaterTexturePickerHandle;
204198

205199
bool mHasUnsavedDescriptionChanges;
206-
bool mVoiceStatus;
207200
bool mWaitingForImageUpload;
208201
bool mAllowPublish;
209202
bool mHideAge;

indra/newview/llviewermenu.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7808,15 +7808,29 @@ class LLAvatarSendIM : public view_listener_t
78087808

78097809
class LLAvatarCall : public view_listener_t
78107810
{
7811+
static LLVOAvatar* findAvatar()
7812+
{
7813+
return find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
7814+
}
7815+
78117816
bool handleEvent(const LLSD& userdata)
78127817
{
7813-
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
7814-
if(avatar)
7818+
if (LLVOAvatar* avatar = findAvatar())
78157819
{
78167820
LLAvatarActions::startCall(avatar->getID());
78177821
}
78187822
return true;
78197823
}
7824+
7825+
public:
7826+
static bool isAvailable()
7827+
{
7828+
if (LLVOAvatar* avatar = findAvatar())
7829+
{
7830+
return LLAvatarActions::canCallTo(avatar->getID());
7831+
}
7832+
return LLAvatarActions::canCall();
7833+
}
78207834
};
78217835

78227836
namespace
@@ -10075,7 +10089,7 @@ void initialize_menus()
1007510089
registrar.add("Avatar.ShowInspector", boost::bind(&handle_avatar_show_inspector));
1007610090
view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
1007710091
view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call", cb_info::UNTRUSTED_BLOCK);
10078-
enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
10092+
enable.add("Avatar.EnableCall", boost::bind(&LLAvatarCall::isAvailable));
1007910093
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse", cb_info::UNTRUSTED_THROTTLE);
1008010094
view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile");
1008110095
view_listener_t::addMenu(new LLAvatarTogglePicks(), "Avatar.TogglePicks");

0 commit comments

Comments
 (0)