From 47044de069c2c1442a33d719846cdbf1e3450124 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 4 Jun 2012 11:23:38 -0400 Subject: STORM-1838 Add "Request Teleport" option to the menu when right-clicking on avatars in the Nearby list --- doc/contributions.txt | 1 + indra/llmessage/message_prehash.cpp | 1 + indra/llmessage/message_prehash.h | 1 + indra/newview/llavataractions.cpp | 13 ++++++ indra/newview/llavataractions.h | 5 +++ indra/newview/llpanelpeoplemenus.cpp | 1 + indra/newview/llviewermessage.cpp | 48 ++++++++++++++++++++++ .../skins/default/xui/en/menu_people_nearby.xml | 7 ++++ .../newview/skins/default/xui/en/notifications.xml | 23 +++++++++++ 9 files changed, 100 insertions(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index 04edfb4bea..cc5fb53b57 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -629,6 +629,7 @@ Jonathan Yap STORM-1809 STORM-1793 STORM-1810 + STORM-1838 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index e71fb96540..64fb6a78a2 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -1379,3 +1379,4 @@ char const* const _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->get char const* const _PREHASH_SeeAVs = LLMessageStringTable::getInstance()->getString("SeeAVs"); char const* const _PREHASH_AnyAVSounds = LLMessageStringTable::getInstance()->getString("AnyAVSounds"); char const* const _PREHASH_GroupAVSounds = LLMessageStringTable::getInstance()->getString("GroupAVSounds"); +char const* const _PREHASH_RequestTeleport = LLMessageStringTable::getInstance()->getString("RequestTeleport"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index dd2c2dbd64..4da1fa7a95 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1379,4 +1379,5 @@ extern char const* const _PREHASH_ProductSKU; extern char const* const _PREHASH_SeeAVs; extern char const* const _PREHASH_AnyAVSounds; extern char const* const _PREHASH_GroupAVSounds; +extern char const* const _PREHASH_RequestTeleport; #endif diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index f618af9536..8df30da68a 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -71,6 +71,7 @@ #include "llcallingcard.h" #include "llslurl.h" // IDEVO #include "llsidepanelinventory.h" +#include "llavatarname.h" // static void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name) @@ -395,6 +396,18 @@ void LLAvatarActions::pay(const LLUUID& id) } } +// static +void LLAvatarActions::requestTeleport(const LLUUID& id) +{ + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_RequestTeleport); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, id); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gAgent.sendReliableMessage(); +} + // static void LLAvatarActions::kick(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 748b7cb3d1..1eee9ea81f 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -108,6 +108,11 @@ public: */ static void pay(const LLUUID& id); + /** + * Request teleport from other avatar + */ + static void requestTeleport(const LLUUID& id); + /** * Share items with the avatar. */ diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index f12c4de2f7..c703ae8768 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -67,6 +67,7 @@ LLContextMenu* NearbyMenu::createMenu() registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::share, id)); registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, id)); registrar.add("Avatar.BlockUnblock", boost::bind(&LLAvatarActions::toggleBlock, id)); + registrar.add("Avatar.RequestTeleport", boost::bind(&LLAvatarActions::requestTeleport, id)); enable_registrar.add("Avatar.EnableItem", boost::bind(&NearbyMenu::enableContextMenuItem, this, _2)); enable_registrar.add("Avatar.CheckItem", boost::bind(&NearbyMenu::checkContextMenuItem, this, _2)); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 854e2bea52..f4f7148340 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1992,6 +1992,54 @@ bool lure_callback(const LLSD& notification, const LLSD& response) } static LLNotificationFunctorRegistration lure_callback_reg("TeleportOffered", lure_callback); +bool teleport_requested_callback(const LLSD& notification, const LLSD& response) +{ + LLUUID from_id = notification["payload"]["from_id"].asUUID(); + std::string from_name; + gCacheName->getFullName(from_id, from_name); + + if(from_id.isNull() || (LLMuteList::getInstance()->isMuted(from_id) && !LLMuteList::getInstance()->isLinden(from_name))) + { + return false; + } + + S32 option = 0; + if (response.isInteger()) + { + option = response.asInteger(); + } + else + { + option = LLNotificationsUtil::getSelectedOption(notification, response); + } + + switch(option) + { + // Yes + case 0: + { + LLAvatarActions::offerTeleport(from_id); + } + break; + + // No + case 1: + default: + break; + + // Block + case 2: + { + LLMute mute(from_id, from_name, LLMute::AGENT); + LLPanelBlockedList::showPanelAndSelect(mute.mID); + } + break; + } + return false; +} + +static LLNotificationFunctorRegistration teleport_requested_callback_reg("TeleportRequested", teleport_requested_callback); + bool goto_url_callback(const LLSD& notification, const LLSD& response) { std::string url = notification["payload"]["url"].asString(); 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 d2e35e4cc0..cff383cab1 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml @@ -70,6 +70,13 @@ + + + + +[NAME] is requesting to be teleported your to your location. + +Will you permit this? + confirm +
+