summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinspectavatar.cpp86
-rw-r--r--indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml20
2 files changed, 93 insertions, 13 deletions
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 91ede6d221..4ad1934264 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -47,6 +47,7 @@
#include "llvoiceclient.h"
#include "llviewerobjectlist.h"
#include "lltransientfloatermgr.h"
+#include "llnotificationsutil.h"
// Linden libraries
#include "llfloater.h"
@@ -126,16 +127,20 @@ private:
void onClickReport();
void onClickFreeze();
void onClickEject();
+ void onClickKick();
+ void onClickCSR();
void onClickZoomIn();
void onClickFindOnMap();
bool onVisibleFindOnMap();
- bool onVisibleFreezeEject();
+ bool onVisibleEject();
+ bool onVisibleFreeze();
bool onVisibleZoomIn();
void onClickMuteVolume();
void onVolumeChange(const LLSD& data);
bool enableMute();
bool enableUnmute();
bool enableTeleportOffer();
+ bool godModeEnabled();
// Is used to determine if "Add friend" option should be enabled in gear menu
bool isNotFriend();
@@ -214,20 +219,21 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
mCommitCallbackRegistrar.add("InspectAvatar.Pay", boost::bind(&LLInspectAvatar::onClickPay, this));
mCommitCallbackRegistrar.add("InspectAvatar.Share", boost::bind(&LLInspectAvatar::onClickShare, this));
mCommitCallbackRegistrar.add("InspectAvatar.ToggleMute", boost::bind(&LLInspectAvatar::onToggleMute, this));
- mCommitCallbackRegistrar.add("InspectAvatar.Freeze",
- boost::bind(&LLInspectAvatar::onClickFreeze, this));
- mCommitCallbackRegistrar.add("InspectAvatar.Eject",
- boost::bind(&LLInspectAvatar::onClickEject, this));
+ mCommitCallbackRegistrar.add("InspectAvatar.Freeze", boost::bind(&LLInspectAvatar::onClickFreeze, this));
+ mCommitCallbackRegistrar.add("InspectAvatar.Eject", boost::bind(&LLInspectAvatar::onClickEject, this));
+ mCommitCallbackRegistrar.add("InspectAvatar.Kick", boost::bind(&LLInspectAvatar::onClickKick, this));
+ mCommitCallbackRegistrar.add("InspectAvatar.CSR", boost::bind(&LLInspectAvatar::onClickCSR, this));
mCommitCallbackRegistrar.add("InspectAvatar.Report", boost::bind(&LLInspectAvatar::onClickReport, this));
mCommitCallbackRegistrar.add("InspectAvatar.FindOnMap", boost::bind(&LLInspectAvatar::onClickFindOnMap, this));
mCommitCallbackRegistrar.add("InspectAvatar.ZoomIn", boost::bind(&LLInspectAvatar::onClickZoomIn, this));
mCommitCallbackRegistrar.add("InspectAvatar.DisableVoice", boost::bind(&LLInspectAvatar::toggleSelectedVoice, this, false));
mCommitCallbackRegistrar.add("InspectAvatar.EnableVoice", boost::bind(&LLInspectAvatar::toggleSelectedVoice, this, true));
+
+ mEnableCallbackRegistrar.add("InspectAvatar.EnableGod", boost::bind(&LLInspectAvatar::godModeEnabled, this));
mEnableCallbackRegistrar.add("InspectAvatar.VisibleFindOnMap", boost::bind(&LLInspectAvatar::onVisibleFindOnMap, this));
- mEnableCallbackRegistrar.add("InspectAvatar.VisibleFreezeEject",
- boost::bind(&LLInspectAvatar::onVisibleFreezeEject, this));
- mEnableCallbackRegistrar.add("InspectAvatar.VisibleZoomIn",
- boost::bind(&LLInspectAvatar::onVisibleZoomIn, this));
+ mEnableCallbackRegistrar.add("InspectAvatar.VisibleEject", boost::bind(&LLInspectAvatar::onVisibleEject, this));
+ mEnableCallbackRegistrar.add("InspectAvatar.VisibleFreeze", boost::bind(&LLInspectAvatar::onVisibleFreeze, this));
+ mEnableCallbackRegistrar.add("InspectAvatar.VisibleZoomIn", boost::bind(&LLInspectAvatar::onVisibleZoomIn, this));
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));
@@ -656,11 +662,18 @@ bool LLInspectAvatar::onVisibleFindOnMap()
return gAgent.isGodlike() || is_agent_mappable(mAvatarID);
}
-bool LLInspectAvatar::onVisibleFreezeEject()
+bool LLInspectAvatar::onVisibleEject()
{
return enable_freeze_eject( LLSD(mAvatarID) );
}
+bool LLInspectAvatar::onVisibleFreeze()
+{
+ // either user is a god and can do long distance freeze
+ // or check for target proximity and permissions
+ return gAgent.isGodlike() || enable_freeze_eject(LLSD(mAvatarID));
+}
+
bool LLInspectAvatar::onVisibleZoomIn()
{
return gObjectList.findObject(mAvatarID);
@@ -725,9 +738,41 @@ void LLInspectAvatar::onClickReport()
closeFloater();
}
+bool godlike_freeze(const LLSD& notification, const LLSD& response)
+{
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ switch (option)
+ {
+ case 0:
+ LLAvatarActions::freeze(avatar_id);
+ break;
+ case 1:
+ LLAvatarActions::unfreeze(avatar_id);
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
+
void LLInspectAvatar::onClickFreeze()
{
- handle_avatar_freeze( LLSD(mAvatarID) );
+ if (gAgent.isGodlike())
+ {
+ // use godlike freeze-at-a-distance, with confirmation
+ LLNotificationsUtil::add("FreezeAvatar",
+ LLSD(),
+ LLSD().with("avatar_id", mAvatarID),
+ godlike_freeze);
+ }
+ else
+ {
+ // use default "local" version of freezing that requires avatar to be in range
+ handle_avatar_freeze( LLSD(mAvatarID) );
+ }
closeFloater();
}
@@ -737,6 +782,20 @@ void LLInspectAvatar::onClickEject()
closeFloater();
}
+void LLInspectAvatar::onClickKick()
+{
+ LLAvatarActions::kick(mAvatarID);
+ closeFloater();
+}
+
+void LLInspectAvatar::onClickCSR()
+{
+ std::string name;
+ gCacheName->getFullName(mAvatarID, name);
+ LLAvatarActions::csr(mAvatarID, name);
+ closeFloater();
+}
+
void LLInspectAvatar::onClickZoomIn()
{
handle_zoom_to_object(mAvatarID);
@@ -785,6 +844,11 @@ bool LLInspectAvatar::enableTeleportOffer()
return LLAvatarActions::canOfferTeleport(mAvatarID);
}
+bool LLInspectAvatar::godModeEnabled()
+{
+ return gAgent.isGodlike();
+}
+
//////////////////////////////////////////////////////////////////////////////
// LLInspectAvatarUtil
//////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
index 58d58a6ca9..76b188220d 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
@@ -78,7 +78,7 @@
<menu_item_call.on_click
function="InspectAvatar.Freeze"/>
<menu_item_call.on_visible
- function="InspectAvatar.VisibleFreezeEject"/>
+ function="InspectAvatar.VisibleFreeze"/>
</menu_item_call>
<menu_item_call
label="Eject"
@@ -86,7 +86,23 @@
<menu_item_call.on_click
function="InspectAvatar.Eject"/>
<menu_item_call.on_visible
- function="InspectAvatar.VisibleFreezeEject"/>
+ function="InspectAvatar.VisibleEject"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Kick"
+ name="kick">
+ <menu_item_call.on_click
+ function="InspectAvatar.Kick"/>
+ <menu_item_call.on_visible
+ function="InspectAvatar.EnableGod"/>
+ </menu_item_call>
+ <menu_item_call
+ label="CSR"
+ name="csr">
+ <menu_item_call.on_click
+ function="InspectAvatar.CSR" />
+ <menu_item_call.on_visible
+ function="InspectAvatar.EnableGod" />
</menu_item_call>
<menu_item_call
label="Debug Textures"