diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index acda10b67ffd3055fa212a0c523a38ba54e7ca21..5c2c39a0e594634421834bc98fa2341c8caf8d01 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -81,10 +81,12 @@ #include "rlvcommon.h" // [/RLVa:KB] +#if 0 // Flags for kick message const U32 KICK_FLAGS_DEFAULT = 0x0; const U32 KICK_FLAGS_FREEZE = 1 << 0; const U32 KICK_FLAGS_UNFREEZE = 1 << 1; +#endif std::string getProfileURL(const std::string& agent_name, bool feed_only) @@ -591,6 +593,7 @@ void LLAvatarActions::teleportRequest(const LLUUID& id) LLNotificationsUtil::add("TeleportRequestPrompt", notification, payload, teleport_request_callback); } +#if 0 // static void LLAvatarActions::kick(const LLUUID& id) { @@ -663,6 +666,7 @@ void LLAvatarActions::unfreeze(const LLUUID& id) payload["avatar_id"] = id; LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, handleUnfreeze); } +#endif //static void LLAvatarActions::csr(const LLUUID& id, std::string name) @@ -1304,6 +1308,7 @@ bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, con return false; } +#if 0 // static bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response) { @@ -1433,6 +1438,7 @@ bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& respo } return false; } +#endif // static void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index f4eca1e92c0223f393dd960b53b7d32572e11063..c1ade33ea43d108ac33579ff769899ea28816818 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -186,6 +186,7 @@ class LLAvatarActions */ static void inviteToGroup(const LLUUID& id); +#if 0 static void freezeAvatar(const LLUUID& id); static void ejectAvatar(const LLUUID& id, bool ban_enabled = false); @@ -203,6 +204,7 @@ class LLAvatarActions * Unfreeze avatar */ static void unfreeze(const LLUUID& id); +#endif /** * Open csr page for avatar @@ -258,11 +260,13 @@ class LLAvatarActions 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); +#if 0 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); +#endif static void callback_invite_to_group(LLUUID group_id, LLUUID id); // Just request friendship, no dialog. diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 51fc37a9d2198513487a7c421f22f630278ff63e..0cab855d14c9d81218c903f77c5715ec4171f036 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -38,6 +38,7 @@ #include "llagentdata.h" // for gAgentID #include "llavataractions.h" #include "llcallingcard.h" // for LLAvatarTracker +#include "llfloaterreporter.h" #include "lllogchat.h" #include "llparcel.h" #include "llviewermenu.h" // for gMenuHolder @@ -85,13 +86,21 @@ 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)); - registrar.add("Avatar.CopyData", [&](LLUICtrl* ctrl, const LLSD& param){ ALAvatarActions::copyData(id, param);}); + registrar.add("Avatar.Freeze", [&](LLUICtrl*, const LLSD& param) { ALAvatarActions::parcelFreeze(id);}); + registrar.add("Avatar.Eject", [&](LLUICtrl*, const LLSD&) { ALAvatarActions::parcelEject(id); }); + registrar.add("Avatar.CopyData", [&](LLUICtrl*, const LLSD& param) { ALAvatarActions::copyData(id, param);}); + registrar.add("Avatar.ManageEstate", [&](LLUICtrl*, const LLSD& param) { + switch (param.asInteger()) + { + case 0: ALAvatarActions::estateTeleportHome(id); break; + case 1: ALAvatarActions::estateKick(id); break; + case 2: ALAvatarActions::estateBan(id); break; + } }); + registrar.add("Avatar.TeleportTo", [&](LLUICtrl*, const LLSD&) { ALAvatarActions::teleportTo(id); }); + registrar.add("Avatar.ReportAbuse", [&](LLUICtrl*, const LLSD&) { LLFloaterReporter::showFromObject(id); }); 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"); @@ -108,7 +117,16 @@ LLContextMenu* PeopleContextMenu::createMenu() registrar.add("Avatar.RemoveFriend", boost::bind(&LLAvatarActions::removeFriendsDialog, mUUIDs)); // registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::startIM, mUUIDs)); // *TODO: unimplemented // registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, mUUIDs)); // *TODO: unimplemented - registrar.add("Avatar.CopyData", [&](LLUICtrl* ctrl, const LLSD& param) { ALAvatarActions::copyData(mUUIDs, param); }); + registrar.add("Avatar.CopyData", [&](LLUICtrl*, const LLSD& param) { ALAvatarActions::copyData(mUUIDs, param); }); + registrar.add("Avatar.Freeze", [&](LLUICtrl*, const LLSD&) { ALAvatarActions::parcelFreeze(mUUIDs); }); + registrar.add("Avatar.Eject", [&](LLUICtrl*, const LLSD&) { ALAvatarActions::parcelEject(mUUIDs); }); + registrar.add("Avatar.ManageEstate", [&](LLUICtrl*, const LLSD& param) { + switch (param.asInteger()) + { + case 0: ALAvatarActions::estateTeleportHome(mUUIDs); break; + case 1: ALAvatarActions::estateKick(mUUIDs); break; + case 2: ALAvatarActions::estateBan(mUUIDs); break; + } }); enable_registrar.add("Avatar.EnableItem", boost::bind(&PeopleContextMenu::enableContextMenuItem, this, _2)); @@ -275,6 +293,18 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata) { return true; } + else if (item == std::string("can_teleport_to")) + { + return ALAvatarActions::canTeleportTo(mUUIDs.front()); + } + else if (item == std::string("can_freeze_eject")) + { + return ALAvatarActions::canFreezeEject(mUUIDs); + } + else if (item == std::string("can_manage_estate")) + { + return ALAvatarActions::canManageAvatarsEstate(mUUIDs); + } return false; } @@ -291,50 +321,6 @@ 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(), @@ -364,39 +350,6 @@ 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; @@ -449,6 +402,23 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags) items.push_back(std::string("pay")); items.push_back(std::string("offer_teleport")); items.push_back(std::string("separator_utils")); + bool can_freeze = ALAvatarActions::canFreezeEject(mUUIDs); + bool can_em = ALAvatarActions::canManageAvatarsEstate(mUUIDs); + if (can_freeze || can_em) + { + items.push_back(std::string("manage_menu")); + if (can_freeze) + { + items.push_back(std::string("freeze")); + items.push_back(std::string("eject")); + } + if (can_em) + { + items.push_back(std::string("teleporthome")); + items.push_back(std::string("estatekick")); + items.push_back(std::string("estateban")); + } + } items.push_back(std::string("utils_menu")); items.push_back(std::string("copy_username")); items.push_back(std::string("copy_display_name")); @@ -470,13 +440,30 @@ void NearbyPeopleContextMenu::buildContextMenu(class LLMenuGL& menu, U32 flags) items.push_back(std::string("invite_to_group")); items.push_back(std::string("separator_invite_to_group")); items.push_back(std::string("zoom_in")); + items.push_back(std::string("teleport_to")); items.push_back(std::string("map")); 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")); items.push_back(std::string("separator_utils")); + items.push_back(std::string("manage_menu")); + items.push_back(std::string("block_unblock")); + items.push_back(std::string("report_abuse")); + bool can_freeze = ALAvatarActions::canFreezeEject(mUUIDs); + bool can_em = ALAvatarActions::canManageAvatarsEstate(mUUIDs); + if (can_freeze || can_em) + { + if (can_freeze) + { + items.push_back(std::string("freeze")); + items.push_back(std::string("eject")); + } + if (can_em) + { + items.push_back(std::string("teleporthome")); + items.push_back(std::string("estatekick")); + items.push_back(std::string("estateban")); + } + } items.push_back(std::string("utils_menu")); items.push_back(std::string("copy_username")); items.push_back(std::string("copy_display_name")); diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h index 6091d37257eefb2245e099ea98cd267338b82d09..b261cbd654289bf54e5f5c0eff7895f8bd8c36bc 100644 --- a/indra/newview/llpanelpeoplemenus.h +++ b/indra/newview/llpanelpeoplemenus.h @@ -49,9 +49,7 @@ class PeopleContextMenu : public LLListContextMenu 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 a4d48a926324c9b39d378ffb4cc293905ee46adc..f0c25efd875197cc89db85ae5a31352642b18534 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml @@ -75,7 +75,7 @@ name="remove_friend"> <menu_item_call.on_click function="Avatar.RemoveFriend" /> - <menu_item_call.on_enable + <menu_item_call.on_visible function="Avatar.EnableItem" parameter="can_delete" /> </menu_item_call> @@ -100,6 +100,16 @@ function="Avatar.EnableItem" parameter="can_zoom_in"/> </menu_item_call> + <menu_item_call + label="Teleport To" + layout="topleft" + name="teleport_to"> + <menu_item_call.on_click + function="Avatar.TeleportTo" /> + <menu_item_call.on_enable + function="Avatar.EnableItem" + parameter="can_teleport_to"/> + </menu_item_call> <menu_item_call label="Map" layout="topleft" @@ -130,6 +140,10 @@ function="Avatar.EnableItem" parameter="can_pay"/> </menu_item_call> + <menu_item_separator name="separator_utils" /> + <context_menu + label="Manage" + name="manage_menu"> <menu_item_check label="Block/Unblock" layout="topleft" @@ -143,13 +157,20 @@ function="Avatar.EnableItem" parameter="can_block" /> </menu_item_check> + <menu_item_call + label="Report" + name="report_abuse"> + <menu_item_call.on_click + function="Avatar.ReportAbuse" /> + </menu_item_call> <menu_item_call label="Freeze" name="freeze"> <menu_item_call.on_click function="Avatar.Freeze" /> <menu_item_call.on_visible - function="Avatar.EnableFreezeEject"/> + function="Avatar.EnableItem" + parameter="can_freeze_eject" /> </menu_item_call> <menu_item_call label="Eject" @@ -157,9 +178,40 @@ <menu_item_call.on_click function="Avatar.Eject" /> <menu_item_call.on_visible - function="Avatar.EnableFreezeEject"/> + function="Avatar.EnableItem" + parameter="can_freeze_eject" /> </menu_item_call> - <menu_item_separator name="separator_utils" /> + <menu_item_call + label="Teleport Home" + name="teleporthome"> + <menu_item_call.on_click + function="Avatar.ManageEstate" + parameter="0" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_manage_estate" /> + </menu_item_call> + <menu_item_call + label="Estate Kick" + name="estatekick"> + <menu_item_call.on_click + function="Avatar.ManageEstate" + parameter="1" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_manage_estate" /> + </menu_item_call> + <menu_item_call + label="Estate Ban" + name="estateban"> + <menu_item_call.on_click + function="Avatar.ManageEstate" + parameter="2" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_manage_estate" /> + </menu_item_call> + </context_menu> <context_menu label="Utilities" name="utils_menu"> diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml index 6ebba578682635f94507dcc3fd8cbc64218d2fe2..4de048f01a11f1e70189f74f3860778d379b52cb 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_multiselect.xml @@ -9,7 +9,7 @@ name="add_friends"> <on_click function="Avatar.AddFriends" /> - <on_enable + <on_visible function="Avatar.EnableItem" parameter="can_add" /> </menu_item_call> @@ -19,7 +19,7 @@ name="remove_friends"> <menu_item_call.on_click function="Avatar.RemoveFriend" /> - <menu_item_call.on_enable + <menu_item_call.on_visible function="Avatar.EnableItem" parameter="can_delete" /> </menu_item_call> @@ -66,7 +66,59 @@ function="Avatar.EnableItem" parameter="can_offer_teleport"/> </menu_item_call> - <menu_item_separator name="separator_utils" /> + <menu_item_separator name="separator_utils" /> + <context_menu + label="Manage" + name="manage_menu"> + <menu_item_call + label="Freeze" + name="freeze"> + <menu_item_call.on_click + function="Avatar.Freeze" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_freeze_eject" /> + </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.EnableItem" + parameter="can_freeze_eject" /> + </menu_item_call> + <menu_item_call + label="Teleport Home" + name="teleporthome"> + <menu_item_call.on_click + function="Avatar.ManageEstate" + parameter="0" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_manage_estate" /> + </menu_item_call> + <menu_item_call + label="Estate Kick" + name="estatekick"> + <menu_item_call.on_click + function="Avatar.ManageEstate" + parameter="1" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_manage_estate" /> + </menu_item_call> + <menu_item_call + label="Estate Ban" + name="estateban"> + <menu_item_call.on_click + function="Avatar.ManageEstate" + parameter="2" /> + <menu_item_call.on_visible + function="Avatar.EnableItem" + parameter="can_manage_estate" /> + </menu_item_call> + </context_menu> <context_menu label="Utilities" name="utils_menu">