Split up enabled checks for request/offer teleports and include RLV into checks for TP offers all over the place

Ansariel 2014-07-11 08:50:24 +02:00
parent 39727765a3
commit 5cdd3864a9
20 changed files with 126 additions and 10 deletions

View File

@ -663,7 +663,7 @@ protected:
}
menu->setItemEnabled("Teleport to", FSCommon::checkIsActionEnabled(mAvatarID, FS_RGSTR_ACT_TELEPORT_TO));
menu->setItemEnabled("Offer Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
menu->setItemEnabled("Request Teleport", LLAvatarActions::canOfferTeleport(mAvatarID));
menu->setItemEnabled("Request Teleport", LLAvatarActions::canRequestTeleport(mAvatarID));
menu->setItemEnabled("Voice Call", LLAvatarActions::canCall());
menu->setItemEnabled("Zoom In", FSCommon::checkIsActionEnabled(mAvatarID, FS_RGSTR_ACT_ZOOM_IN));
menu->setItemEnabled("track", FSCommon::checkIsActionEnabled(mAvatarID, FS_RGSTR_ACT_TRACK_AVATAR));

View File

@ -309,10 +309,14 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct
{
return (!isSelf && LLAvatarActions::canZoomIn(av_id));
}
else if (action == FS_RGSTR_ACT_OFFER_TELEPORT || action == FS_RGSTR_ACT_REQUEST_TELEPORT)
else if (action == FS_RGSTR_ACT_OFFER_TELEPORT)
{
return (!isSelf && LLAvatarActions::canOfferTeleport(av_id));
}
else if (action == FS_RGSTR_ACT_REQUEST_TELEPORT)
{
return (!isSelf && LLAvatarActions::canRequestTeleport(av_id));
}
else if (action == FS_RGSTR_ACT_SHOW_PROFILE)
{
return (isSelf || !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));

View File

@ -51,6 +51,7 @@
#include "llvoiceclient.h"
#include "fscommon.h"
#include "llviewermenu.h"
#include "rlvhandler.h"
//Maximum number of people you can select to do an operation on at once.
const U32 MAX_FRIEND_SELECT = 20;
@ -704,16 +705,25 @@ void FSFloaterContacts::refreshRightsChangeList()
bool selected_friends_online = true;
const LLRelationship* friend_status = NULL;
for(std::vector<LLUUID>::iterator itr = friends.begin(); itr != friends.end(); ++itr)
for (uuid_vec_t::iterator itr = friends.begin(); itr != friends.end(); ++itr)
{
friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr);
if (friend_status)
{
if(!friend_status->isOnline())
if (!friend_status->isOnline())
{
can_offer_teleport = false;
selected_friends_online = false;
}
else
{
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC) &&
!gRlvHandler.isException(RLV_BHVR_TPLURE, *itr, RLV_CHECK_PERMISSIVE) &&
!friend_status->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION))
{
can_offer_teleport = false;
}
}
}
else // missing buddy info, don't allow any operations
{

View File

@ -141,6 +141,7 @@ FSFloaterIM::FSFloaterIM(const LLUUID& session_id)
}
mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&FSFloaterIM::doToSelected, this, _2));
mEnableCallbackRegistrar.add("IMSession.Menu.Enable", boost::bind(&FSFloaterIM::checkEnabled, this, _2));
setOverlapsScreenChannel(true);
@ -478,6 +479,16 @@ void FSFloaterIM::doToSelected(const LLSD& userdata)
LL_WARNS("FSFloaterIM") << "Unhandled command '" << command << "'. Ignoring." << LL_ENDL;
}
bool FSFloaterIM::checkEnabled(const LLSD& userdata)
{
const std::string command = userdata.asString();
if (command == "enable_offer_tp")
{
return LLAvatarActions::canOfferTeleport(mOtherParticipantUUID);
}
return false;
}
// support sysinfo button -Zi
void FSFloaterIM::onSysinfoButtonClicked()
{

View File

@ -182,6 +182,7 @@ private:
static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);
void doToSelected(const LLSD& userdata);
bool checkEnabled(const LLSD& userdata);
// support sysinfo button -Zi
void onSysinfoButtonClicked();

View File

@ -215,6 +215,14 @@ bool FSRadarMenu::enableContextMenuItem(const LLSD& userdata)
{
return LLAvatarActions::canOfferTeleport(mUUIDs);
}
else if(item == std::string("can_request_teleport"))
{
if (mUUIDs.size() == 1)
{
return LLAvatarActions::canRequestTeleport(mUUIDs.front());
}
return false;
}
else if (item == std::string("can_open_inventory"))
{
return (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));

View File

@ -1147,6 +1147,21 @@ void LLAvatarActions::toggleMuteVoice(const LLUUID& id)
// static
bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
{
// <FS:Ansariel> RLV support
// Only allow offering teleports if everyone is a @tplure exception or able to map this avie under @showloc=n
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
const LLRelationship* pBuddyInfo = LLAvatarTracker::instance().getBuddyInfo(id);
if (gRlvHandler.isException(RLV_BHVR_TPLURE, id, RLV_CHECK_PERMISSIVE) ||
(pBuddyInfo && pBuddyInfo->isOnline() && pBuddyInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION)))
{
return true;
}
return false;
}
// </FS:Ansariel>
// First use LLAvatarTracker::isBuddy()
// If LLAvatarTracker::instance().isBuddyOnline function only is used
// then for avatars that are online and not a friend it will return false.
@ -1195,6 +1210,18 @@ bool LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids)
// </FS:Ansariel>
}
// <FS:Ansariel> Extra request teleport
// static
bool LLAvatarActions::canRequestTeleport(const LLUUID& id)
{
if(LLAvatarTracker::instance().isBuddy(id))
{
return LLAvatarTracker::instance().isBuddyOnline(id);
}
return true;
}
void LLAvatarActions::inviteToGroup(const LLUUID& id)
{
LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(id));

View File

@ -216,6 +216,9 @@ public:
*/
static bool canOfferTeleport(const uuid_vec_t& ids);
// <FS:Ansariel> Extra request teleport
static bool canRequestTeleport(const LLUUID& id);
/**
* Checks whether all items selected in the given inventory panel can be shared
*

View File

@ -404,6 +404,12 @@ bool LLConversationLogList::isActionEnabled(const LLSD& userdata)
{
return is_p2p && LLAvatarActions::canOfferTeleport(selected_id);
}
// <FS:Ansariel> Extra request teleport
else if("can_request_teleport" == command_name)
{
return is_p2p && LLAvatarActions::canRequestTeleport(selected_id);
}
// </FS:Ansariel>
else if ("can_show_on_map" == command_name)
{
return is_p2p && ((LLAvatarTracker::instance().isBuddyOnline(selected_id) && is_agent_mappable(selected_id)) || gAgent.isGodlike());

View File

@ -132,6 +132,7 @@ private:
void onClickIM();
void onClickCall();
void onClickTeleport();
void onClickTeleportRequest();
void onClickInviteToGroup();
void onClickPay();
void onClickShare();
@ -150,6 +151,7 @@ private:
bool enableMute();
bool enableUnmute();
bool enableTeleportOffer();
bool enableTeleportRequest();
bool godModeEnabled();
// Is used to determine if "Add friend" option should be enabled in gear menu
@ -251,6 +253,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableCall", boost::bind(&LLAvatarActions::canCall));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableTeleportOffer", boost::bind(&LLInspectAvatar::enableTeleportOffer, this));
mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableTeleportRequest", boost::bind(&LLInspectAvatar::enableTeleportRequest, this));
mEnableCallbackRegistrar.add("InspectAvatar.EnableMute", boost::bind(&LLInspectAvatar::enableMute, this));
mEnableCallbackRegistrar.add("InspectAvatar.EnableUnmute", boost::bind(&LLInspectAvatar::enableUnmute, this));
// </FS:Ansariel>
@ -737,6 +740,12 @@ void LLInspectAvatar::onClickTeleport()
closeFloater();
}
void LLInspectAvatar::onClickTeleportRequest()
{
LLAvatarActions::teleportRequest(mAvatarID);
closeFloater();
}
void LLInspectAvatar::onClickInviteToGroup()
{
LLAvatarActions::inviteToGroup(mAvatarID);
@ -884,6 +893,11 @@ bool LLInspectAvatar::enableTeleportOffer()
return LLAvatarActions::canOfferTeleport(mAvatarID);
}
bool LLInspectAvatar::enableTeleportRequest()
{
return LLAvatarActions::canRequestTeleport(mAvatarID);
}
bool LLInspectAvatar::godModeEnabled()
{
return gAgent.isGodlike();

View File

@ -214,6 +214,7 @@ BOOL LLNetMap::postBuild()
enable_registrar.add("Minimap.CanMap", boost::bind(&LLNetMap::canMap, this));
enable_registrar.add("Minimap.CanShare", boost::bind(&LLNetMap::canShare, this));
enable_registrar.add("Minimap.CanOfferTeleport", boost::bind(&LLNetMap::canOfferTeleport, this));
enable_registrar.add("Minimap.CanRequestTeleport", boost::bind(&LLNetMap::canRequestTeleport, this));
enable_registrar.add("Minimap.IsBlocked", boost::bind(&LLNetMap::isBlocked, this));
enable_registrar.add("Minimap.CanBlock", boost::bind(&LLNetMap::canBlock, this));
enable_registrar.add("Minimap.VisibleFreezeEject", boost::bind(&LLNetMap::canFreezeEject, this));
@ -1928,6 +1929,13 @@ bool LLNetMap::canOfferTeleport()
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, FS_RGSTR_ACT_OFFER_TELEPORT);
}
// <FS:Ansariel> Extra request teleport
bool LLNetMap::canRequestTeleport()
{
return FSCommon::checkIsActionEnabled(mClosestAgentRightClick, FS_RGSTR_ACT_REQUEST_TELEPORT);
}
// </FS:Ansariel>
bool LLNetMap::canBlock()
{
return LLAvatarActions::canBlock(mClosestAgentRightClick);

View File

@ -216,6 +216,8 @@ private:
bool canFreezeEject();
bool canKickTeleportHome();
bool isBlocked();
// <FS:Ansariel> Extra request teleport
bool canRequestTeleport();
void handleAddFriend();
void handleAddToContactSet();

View File

@ -247,6 +247,16 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata)
{
return LLAvatarActions::canOfferTeleport(mUUIDs);
}
// <FS:Ansariel> Extra request teleport
else if(item == std::string("can_request_teleport"))
{
if (mUUIDs.size() == 1)
{
return LLAvatarActions::canRequestTeleport(mUUIDs.front());
}
return false;
}
// </FS:Ansariel>
// <FS:Ansariel> FIRE-8804: Prevent opening inventory from using share in radar context menu
else if (item == std::string("can_open_inventory"))
{

View File

@ -4,7 +4,8 @@
<menu_item_call label="Freund hinzufügen" name="add_friend"/>
<menu_item_call label="IM" name="im"/>
<menu_item_call label="Anrufen" name="call"/>
<menu_item_call label="Teleportieren" name="teleport"/>
<menu_item_call label="Teleport anbieten" name="teleport"/>
<menu_item_call label="Teleport anfordern" name="request_teleport"/>
<menu_item_call label="In Gruppe einladen" name="invite_to_group"/>
<menu_item_call label="Ignorieren" name="block"/>
<menu_item_call label="Freischalten" name="unblock"/>

View File

@ -75,7 +75,7 @@
parameter="request_teleport"/>
<on_enable
function="Calllog.Enable"
parameter="can_offer_teleport"/>
parameter="can_request_teleport"/>
</menu_item_call>
<menu_item_separator />
<menu_item_call

View File

@ -9,6 +9,9 @@
<menu_item_call.on_click
function="IMSession.Menu.Action"
parameter="offer_tp"/>
<menu_item_call.on_enable
function="IMSession.Menu.Enable"
parameter="enable_offer_tp"/>
</menu_item_call>
<menu_item_call
label="Request teleport"

View File

@ -154,7 +154,7 @@
function="Avatar.TeleportRequest"/>
<menu_item_call.on_enable
function="Avatar.EnableItem"
parameter="can_offer_teleport"/>
parameter="can_request_teleport"/>
</menu_item_call>
<menu_item_call
label="Teleport To"

View File

@ -36,13 +36,21 @@
function="InspectAvatar.Gear.EnableCall"/>
</menu_item_call>
<menu_item_call
label="Teleport"
label="Offer Teleport"
name="teleport">
<menu_item_call.on_click
function="InspectAvatar.Teleport"/>
<menu_item_call.on_enable
function="InspectAvatar.Gear.EnableTeleportOffer"/>
</menu_item_call>
<menu_item_call
label="Request Teleport"
name="request_teleport">
<menu_item_call.on_click
function="InspectAvatar.TeleportRequest"/>
<menu_item_call.on_enable
function="InspectAvatar.Gear.EnableTeleportRequest"/>
</menu_item_call>
<menu_item_call
label="Invite to Group"
name="invite_to_group">

View File

@ -159,7 +159,7 @@
<menu_item_call.on_click
function="Minimap.RequestTeleport"/>
<menu_item_call.on_enable
function="Minimap.CanOfferTeleport"/>
function="Minimap.CanRequestTeleport"/>
</menu_item_call>
<menu_item_call
label="Teleport To"

View File

@ -35,7 +35,7 @@
function="Avatar.TeleportRequest"/>
<menu_item_call.on_enable
function="Avatar.EnableItem"
parameter="can_offer_teleport"/>
parameter="can_request_teleport"/>
</menu_item_call>
<menu_item_call
label="Voice call"