summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2016-04-11 14:25:08 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2016-04-11 14:25:08 +0300
commit1a2d326c2b7b24139c85dc10f63ecfd37db7eca4 (patch)
tree97b2c72dd48d882bfda23ca5e192485bcfae882e /indra/newview
parentf5c21ce1aef74bd79cbcb8c7a6cd4f9f4891c993 (diff)
MAINT-6273 "Freeze" and "Eject" menu items are added to Nearby context menu.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llavataractions.cpp122
-rwxr-xr-xindra/newview/llavataractions.h5
-rwxr-xr-xindra/newview/llpanelpeoplemenus.cpp88
-rwxr-xr-xindra/newview/llpanelpeoplemenus.h2
-rwxr-xr-xindra/newview/skins/default/xui/en/menu_people_nearby.xml16
5 files changed, 231 insertions, 2 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 00bc8ebe87..a6e745448a 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -476,13 +476,63 @@ void LLAvatarActions::kick(const LLUUID& id)
}
// static
+void LLAvatarActions::freezeAvatar(const LLUUID& id)
+{
+ std::string fullname;
+ gCacheName->getFullName(id, fullname);
+ LLSD payload;
+ payload["avatar_id"] = id;
+
+ if (!fullname.empty())
+ {
+ LLSD args;
+ args["AVATAR_NAME"] = fullname;
+ LLNotificationsUtil::add("FreezeAvatarFullname", args, payload, handleFreezeAvatar);
+ }
+ else
+ {
+ LLNotificationsUtil::add("FreezeAvatar", LLSD(), payload, handleFreezeAvatar);
+ }
+}
+
+// static
+void LLAvatarActions::ejectAvatar(const LLUUID& id, bool ban_enabled)
+{
+ std::string fullname;
+ gCacheName->getFullName(id, fullname);
+ LLSD payload;
+ payload["avatar_id"] = id;
+ payload["ban_enabled"] = ban_enabled;
+ LLSD args;
+ if (!fullname.empty())
+ {
+ args["AVATAR_NAME"] = fullname;
+ }
+
+ if (ban_enabled)
+ {
+ LLNotificationsUtil::add("EjectAvatarFullname", args, payload, handleEjectAvatar);
+ }
+ else
+ {
+ if (!fullname.empty())
+ {
+ LLNotificationsUtil::add("EjectAvatarFullnameNoBan", args, payload, handleEjectAvatar);
+ }
+ else
+ {
+ LLNotificationsUtil::add("EjectAvatarNoBan", LLSD(), payload, handleEjectAvatar);
+ }
+ }
+}
+
+// static
void LLAvatarActions::freeze(const LLUUID& id)
{
LLSD payload;
payload["avatar_id"] = id;
LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze);
}
-
// static
void LLAvatarActions::unfreeze(const LLUUID& id)
{
@@ -1133,10 +1183,77 @@ bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response)
}
return false;
}
-bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response)
+
+bool LLAvatarActions::handleFreezeAvatar(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
+ if (0 == option || 1 == option)
+ {
+ U32 flags = 0x0;
+ if (1 == option)
+ {
+ // unfreeze
+ flags |= 0x1;
+ }
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ LLMessageSystem* msg = gMessageSystem;
+
+ msg->newMessage("FreezeUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID());
+ msg->addUUID("SessionID", gAgent.getSessionID());
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ gAgent.sendReliableMessage();
+ }
+ return false;
+}
+
+bool LLAvatarActions::handleEjectAvatar(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (2 == option)
+ {
+ return false;
+ }
+ LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
+ bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean();
+
+ if (0 == option)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ U32 flags = 0x0;
+ msg->newMessage("EjectUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ gAgent.sendReliableMessage();
+ }
+ else if (ban_enabled)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+
+ U32 flags = 0x1;
+ msg->newMessage("EjectUser");
+ msg->nextBlock("AgentData");
+ msg->addUUID("AgentID", gAgent.getID() );
+ msg->addUUID("SessionID", gAgent.getSessionID() );
+ msg->nextBlock("Data");
+ msg->addUUID("TargetID", avatar_id );
+ msg->addU32("Flags", flags );
+ gAgent.sendReliableMessage();
+ }
+ return false;
+}
+
+bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
if (option == 0)
{
LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
@@ -1153,6 +1270,7 @@ bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& respons
}
return false;
}
+
bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index bd0ac24e93..256d44d820 100755
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -173,6 +173,9 @@ public:
*/
static void inviteToGroup(const LLUUID& id);
+ static void freezeAvatar(const LLUUID& id);
+
+ static void ejectAvatar(const LLUUID& id, bool ban_enabled = false);
/**
* Kick avatar off grid
*/
@@ -242,6 +245,8 @@ private:
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
static bool handleRemove(const LLSD& notification, const LLSD& response);
static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id);
+ static bool handleFreezeAvatar(const LLSD& notification, const LLSD& response);
+ static bool handleEjectAvatar(const LLSD& notification, const LLSD& response);
static bool handleKick(const LLSD& notification, const LLSD& response);
static bool handleFreeze(const LLSD& notification, const LLSD& response);
static bool handleUnfreeze(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index a5f59dbf4a..65769ff526 100755
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -38,9 +38,14 @@
#include "llavataractions.h"
#include "llcallingcard.h" // for LLAvatarTracker
#include "lllogchat.h"
+#include "llparcel.h"
#include "llviewermenu.h" // for gMenuHolder
#include "llconversationmodel.h"
#include "llviewerobjectlist.h"
+#include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
+#include "llvoavatarself.h"
+#include "roles_constants.h"
namespace LLPanelPeopleMenus
{
@@ -77,9 +82,13 @@ LLContextMenu* PeopleContextMenu::createMenu()
registrar.add("Avatar.InviteToGroup", boost::bind(&LLAvatarActions::inviteToGroup, id));
registrar.add("Avatar.TeleportRequest", boost::bind(&PeopleContextMenu::requestTeleport, this));
registrar.add("Avatar.Calllog", boost::bind(&LLAvatarActions::viewChatHistory, id));
+ registrar.add("Avatar.Freeze", boost::bind(&LLAvatarActions::freezeAvatar, id));
+ registrar.add("Avatar.Eject", boost::bind(&PeopleContextMenu::eject, this));
+
enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2));
enable_registrar.add("Avatar.CheckItem", boost::bind(&PeopleContextMenu::checkContextMenuItem, this, _2));
+ enable_registrar.add("Avatar.EnableFreezeEject", boost::bind(&PeopleContextMenu::enableFreezeEject, this, _2));
// create the context menu from the XUI
menu = createFromFile("menu_people_nearby.xml");
@@ -258,6 +267,50 @@ bool PeopleContextMenu::checkContextMenuItem(const LLSD& userdata)
return false;
}
+bool PeopleContextMenu::enableFreezeEject(const LLSD& userdata)
+{
+ if((gAgent.getID() == mUUIDs.front()) || (mUUIDs.size() != 1))
+ {
+ return false;
+ }
+
+ const LLUUID& id = mUUIDs.front();
+
+ // Use avatar_id if available, otherwise default to right-click avatar
+ LLVOAvatar* avatar = NULL;
+ if (id.notNull())
+ {
+ LLViewerObject* object = gObjectList.findObject(id);
+ if (object)
+ {
+ if( !object->isAvatar() )
+ {
+ object = NULL;
+ }
+ avatar = (LLVOAvatar*) object;
+ }
+ }
+ if (!avatar) return false;
+
+ // Gods can always freeze
+ if (gAgent.isGodlike()) return true;
+
+ // Estate owners / managers can freeze
+ // Parcel owners can also freeze
+ const LLVector3& pos = avatar->getPositionRegion();
+ const LLVector3d& pos_global = avatar->getPositionGlobal();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel();
+ LLViewerRegion* region = avatar->getRegion();
+ if (!region) return false;
+
+ bool new_value = region->isOwnedSelf(pos);
+ if (!new_value || region->isOwnedGroup(pos))
+ {
+ new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN);
+ }
+ return new_value;
+}
+
void PeopleContextMenu::requestTeleport()
{
// boost::bind cannot recognize overloaded method LLAvatarActions::teleportRequest(),
@@ -272,6 +325,39 @@ void PeopleContextMenu::offerTeleport()
LLAvatarActions::offerTeleport(mUUIDs);
}
+void PeopleContextMenu::eject()
+{
+ if((gAgent.getID() == mUUIDs.front()) || (mUUIDs.size() != 1))
+ {
+ return;
+ }
+
+ const LLUUID& id = mUUIDs.front();
+
+ // Use avatar_id if available, otherwise default to right-click avatar
+ LLVOAvatar* avatar = NULL;
+ if (id.notNull())
+ {
+ LLViewerObject* object = gObjectList.findObject(id);
+ if (object)
+ {
+ if( !object->isAvatar() )
+ {
+ object = NULL;
+ }
+ avatar = (LLVOAvatar*) object;
+ }
+ }
+ if (!avatar) return;
+ LLSD payload;
+ payload["avatar_id"] = avatar->getID();
+ std::string fullname = avatar->getFullname();
+
+ const LLVector3d& pos = avatar->getPositionGlobal();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel();
+ LLAvatarActions::ejectAvatar(id ,LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED));
+}
+
void PeopleContextMenu::startConference()
{
uuid_vec_t uuids;
@@ -320,6 +406,8 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags)
items.push_back(std::string("share"));
items.push_back(std::string("pay"));
items.push_back(std::string("block_unblock"));
+ items.push_back(std::string("freeze"));
+ items.push_back(std::string("eject"));
}
hide_context_entries(menu, items, disabled_items);
diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h
index 9767bab89f..5ed20e0064 100755
--- a/indra/newview/llpanelpeoplemenus.h
+++ b/indra/newview/llpanelpeoplemenus.h
@@ -46,7 +46,9 @@ protected:
private:
bool enableContextMenuItem(const LLSD& userdata);
bool checkContextMenuItem(const LLSD& userdata);
+ bool enableFreezeEject(const LLSD& userdata);
void offerTeleport();
+ void eject();
void startConference();
void requestTeleport();
};
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
index f12226ebeb..c1500d4e7c 100755
--- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
@@ -143,4 +143,20 @@
function="Avatar.EnableItem"
parameter="can_block" />
</menu_item_check>
+ <menu_item_call
+ label="Freeze"
+ name="freeze">
+ <menu_item_call.on_click
+ function="Avatar.Freeze" />
+ <menu_item_call.on_visible
+ function="Avatar.EnableFreezeEject"/>
+ </menu_item_call>
+ <menu_item_call
+ label="Eject"
+ name="eject">
+ <menu_item_call.on_click
+ function="Avatar.Eject" />
+ <menu_item_call.on_visible
+ function="Avatar.EnableFreezeEject"/>
+ </menu_item_call>
</context_menu>