Fixed low bug EXT - 3255 (Call button is enabled in the People & Profile panels while voice is disabled)

--HG--
branch : product-engine
meow-7.2.2
Paul Guslisty 2009-12-14 19:53:54 +02:00
parent 37b039b9fd
commit fe0da9bf7b
8 changed files with 74 additions and 2 deletions

View File

@ -61,6 +61,7 @@
#include "llviewerregion.h"
#include "llimfloater.h"
#include "lltrans.h"
#include "llcallingcard.h"
// static
void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name)
@ -265,6 +266,24 @@ bool LLAvatarActions::isCalling(const LLUUID &id)
return (LLIMModel::getInstance()->findIMSession(session_id) != NULL);
}
//static
bool LLAvatarActions::canCall(const LLUUID &id)
{
if(isFriend(id))
{
return LLAvatarTracker::instance().isBuddyOnline(id) && LLVoiceClient::voiceEnabled();
}
else
{
// don't need to check online/offline status because "usual resident" (resident that is not a friend)
// can be only ONLINE. There is no way to see "usual resident" in OFFLINE status. If we see "usual
// resident" it automatically means that the resident is ONLINE. So to make a call to the "usual resident"
// we need to check only that "our" voice is enabled.
return LLVoiceClient::voiceEnabled();
}
}
// static
void LLAvatarActions::startConference(const std::vector<LLUUID>& ids)
{

View File

@ -128,6 +128,11 @@ public:
*/
static bool isCalling(const LLUUID &id);
/**
* @return true if call to the resident can be made (resident is online and voice is enabled)
*/
static bool canCall(const LLUUID &id);
/**
* Invite avatar to a group.
*/

View File

@ -396,7 +396,7 @@ void LLPanelProfileTab::updateButtons()
&& gAgent.isGodlike() || is_agent_mappable(getAvatarId());
childSetEnabled("show_on_map_btn", enable_map_btn);
childSetEnabled("call", LLVoiceClient::voiceEnabled());
childSetEnabled("call", LLAvatarActions::canCall(getAvatarId()));
}
//////////////////////////////////////////////////////////////////////////

View File

@ -776,7 +776,7 @@ void LLPanelPeople::updateButtons()
buttonSetEnabled("teleport_btn", friends_tab_active && item_selected && isFriendOnline(selected_uuids.front()));
buttonSetEnabled("view_profile_btn", item_selected);
buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection
buttonSetEnabled("call_btn", multiple_selected && LLVoiceClient::voiceEnabled());
buttonSetEnabled("call_btn", multiple_selected && canCall());
buttonSetEnabled("share_btn", item_selected); // not implemented yet
bool none_group_selected = item_selected && selected_id.isNull();
@ -784,6 +784,29 @@ void LLPanelPeople::updateButtons()
buttonSetEnabled("chat_btn", !none_group_selected);
}
bool LLPanelPeople::canCall()
{
std::vector<LLUUID> selected_uuids;
getCurrentItemIDs(selected_uuids);
bool result = false;
std::vector<LLUUID>::const_iterator
id = selected_uuids.begin(),
uuids_end = selected_uuids.end();
for (;id != uuids_end; ++id)
{
if (LLAvatarActions::canCall(*id))
{
result = true;
break;
}
}
return result;
}
std::string LLPanelPeople::getActiveTabName() const
{
return mTabContainer->getCurrentPanel()->getName();

View File

@ -73,6 +73,7 @@ private:
bool isFriendOnline(const LLUUID& id);
bool isItemsFreeOfFriends(const std::vector<LLUUID>& uuids);
bool canCall();
void updateButtons();
std::string getActiveTabName() const;

View File

@ -181,7 +181,25 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
const LLUUID& id = mUUIDs.front();
return LLAvatarActions::isFriend(id);
}
else if (item == std::string("can_call"))
{
bool result = false;
int size = mUUIDs.size();
std::cout << size << std::endl;
std::vector<LLUUID>::const_iterator
id = mUUIDs.begin(),
uuids_end = mUUIDs.end();
for (;id != uuids_end; ++id)
{
if (LLAvatarActions::canCall(*id))
{
result = true;
break;
}
}
return result;
}
return false;
}

View File

@ -32,6 +32,9 @@
name="Call">
<menu_item_call.on_click
function="Avatar.Call" />
<menu_item_call.on_enable
function="Avatar.EnableItem"
parameter="can_call" />
</menu_item_call>
<menu_item_call
label="Share"

View File

@ -27,6 +27,9 @@
name="Call">
<on_click
function="Avatar.Call" />
<on_enable
function="Avatar.EnableItem"
parameter="can_call" />
</menu_item_call>
<menu_item_call
enabled="false"