From f64e11dfe1490c1a89e00cf5dc368dd1dc25b866 Mon Sep 17 00:00:00 2001 From: Jonathan Yap <none@none> Date: Thu, 24 Jan 2013 14:27:10 -0500 Subject: [PATCH] STORM-1838 Add optional message processing --- indra/newview/llavataractions.cpp | 17 ++++++++++---- indra/newview/llavataractions.h | 1 + indra/newview/llviewermessage.cpp | 21 ++++++++++-------- .../skins/default/xui/en/notifications.xml | 22 +++++++++++++++++++ 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 51313f29c41..d8449570a71 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -397,8 +397,7 @@ void LLAvatarActions::pay(const LLUUID& id) } } -// static -void LLAvatarActions::teleportRequest(const LLUUID& id) +void LLAvatarActions::teleport_request_callback(const LLSD& notification, const LLSD& response) { LLMessageSystem* msg = gMessageSystem; @@ -409,7 +408,7 @@ void LLAvatarActions::teleportRequest(const LLUUID& id) msg->nextBlockFast(_PREHASH_MessageBlock); msg->addBOOLFast(_PREHASH_FromGroup, FALSE); - msg->addUUIDFast(_PREHASH_ToAgentID, id); + msg->addUUIDFast(_PREHASH_ToAgentID, notification["substitutions"]["uuid"] ); msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); msg->addU8Fast(_PREHASH_Dialog, IM_TELEPORT_REQUEST); msg->addUUIDFast(_PREHASH_ID, LLUUID::null); @@ -419,7 +418,7 @@ void LLAvatarActions::teleportRequest(const LLUUID& id) LLAgentUI::buildFullname(name); msg->addStringFast(_PREHASH_FromAgentName, name); - msg->addStringFast(_PREHASH_Message, LLStringUtil::null); + msg->addStringFast(_PREHASH_Message, response["message"]); msg->addU32Fast(_PREHASH_ParentEstateID, 0); msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); @@ -433,6 +432,16 @@ void LLAvatarActions::teleportRequest(const LLUUID& id) llwarns << "DBG REQUEST_TELEPORT sent" << llendl; } +// static +void LLAvatarActions::teleportRequest(const LLUUID& id) +{ + LLSD notification; + notification["uuid"] = id; + LLSD payload; + + LLNotificationsUtil::add("TeleportRequestPrompt", notification, payload, teleport_request_callback); +} + // static void LLAvatarActions::kick(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index f3df953e982..afd8060ee3c 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -112,6 +112,7 @@ class LLAvatarActions * Request teleport from other avatar */ static void teleportRequest(const LLUUID& id); + static void teleport_request_callback(const LLSD& notification, const LLSD& response); /** * Share items with the avatar. diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8a955377daf..7247dfcd658 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6765,7 +6765,8 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) // Caution: this function is also called directly by teleport_request_callback using dummied-up parameters. // If you make a change here that uses additional fields in notification or response // make sure to add appropriate dummy values in teleport_request_callback. - +llwarns << "DBB notification=" << notification << llendl; +llwarns << "DBG response=" << response << llendl; static const unsigned OFFER_RECIPIENT_LIMIT = 250; if(notification["payload"]["ids"].size() > OFFER_RECIPIENT_LIMIT) { @@ -6893,18 +6894,20 @@ bool teleport_request_callback(const LLSD& notification, const LLSD& response) // Yes case 0: { - LLSD notification; - notification["payload"]["ids"] = from_id; - notification["form"][0]["type"] = "button"; - notification["form"][0]["index"] = 0; + LLSD dummy_notification; + dummy_notification["payload"]["ids"][0] = from_id; + dummy_notification["form"]["name"][0] = "OK"; + dummy_notification["form"]["text"][0] = "OK"; + dummy_notification["form"]["type"][0] = "button"; - LLSD response; - response["message"] = "Join me in "; - response["name"][0] = 1; + + LLSD dummy_response; + dummy_response["message"] = response["message"]; + dummy_response["OK"] = 1; // Calling handle_lure_callback directly is a bit of a hack to avoid having to copy most of // the code from this routine. - handle_lure_callback(notification, response); + handle_lure_callback(dummy_notification, dummy_response); } break; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0628e549023..3baf2231725 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3927,6 +3927,27 @@ Join me in [REGION] </form> </notification> + <notification + icon="alertmodal.tga" + name="TeleportRequestPrompt" + type="alertmodal"> +Request a teleport to their location with the following message + <tag>confirm</tag> + <form name="form"> + <input name="message" type="text"> + + </input> + <button + default="true" + index="0" + name="OK" + text="OK"/> + <button + index="1" + name="Cancel" + text="Cancel"/> + </form> + </notification> <notification icon="alertmodal.tga" name="TooManyTeleportOffers" @@ -6520,6 +6541,7 @@ However, this region contains content accessible to adults only. name="TeleportRequest" type="notify"> [NAME_SLURL] is requesting to be teleported your to your location. +[MESSAGE] Will you permit this? <tag>confirm</tag> -- GitLab