From d97355a19f3b88512105965cfd752956f0230b41 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 19 Oct 2010 19:55:19 +0300 Subject: STORM-390 FIXED "Place Profile" appeared instead of "Resident Profile" after clicking on user name in a nearby chat toast. Now clicking an avatar name opens avatar profile; clicking an object name opens object inspector. This change rolls back the fix of STORM-358. --- indra/newview/llchatitemscontainerctrl.cpp | 59 +++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index ababa71348..d353c809ca 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -31,6 +31,7 @@ #include "llchatmsgbox.h" #include "llavatariconctrl.h" +#include "llcommandhandler.h" #include "llfloaterreg.h" #include "lllocalcliprect.h" #include "lltrans.h" @@ -44,6 +45,40 @@ static const S32 msg_left_offset = 10; static const S32 msg_right_offset = 10; static const S32 msg_height_pad = 5; +//******************************************************************************************************************* +// LLObjectHandler +//******************************************************************************************************************* + +// handle secondlife:///app/object//inspect SLURLs +class LLObjectHandler : public LLCommandHandler +{ +public: + LLObjectHandler() : LLCommandHandler("object", UNTRUSTED_BLOCK) { } + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + if (params.size() < 2) return false; + + LLUUID object_id; + if (!object_id.set(params[0], FALSE)) + { + return false; + } + + const std::string verb = params[1].asString(); + + if (verb == "inspect") + { + LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id)); + return true; + } + + return false; + } +}; + +LLObjectHandler gObjectHandler; + //******************************************************************************************************************* //LLNearbyChatToastPanel //******************************************************************************************************************* @@ -169,17 +204,26 @@ void LLNearbyChatToastPanel::init(LLSD& notification) { std::string str_sender; - str_sender = ""; // disable parsing URLs in object names (STORM-358) - str_sender += fromName; - str_sender += ""; + str_sender = fromName; str_sender+=" "; - //append user name + //append sender name + if (mSourceType == CHAT_SOURCE_AGENT || mSourceType == CHAT_SOURCE_OBJECT) { LLStyle::Params style_params_name; LLColor4 userNameColor = LLUIColorTable::instance().getColor("ChatToastAgentNameColor"); + std::string href; + + if (mSourceType == CHAT_SOURCE_AGENT) + { + href = LLSLURL("agent", mFromID, "about").getSLURLString(); + } + else + { + href = LLSLURL("object", mFromID, "inspect").getSLURLString(); + } style_params_name.color(userNameColor); @@ -188,11 +232,16 @@ void LLNearbyChatToastPanel::init(LLSD& notification) style_params_name.font.name(font_name); style_params_name.font.size(font_style_size); - style_params_name.link_href = LLSLURL("agent",mFromID,"about").getSLURLString(); + style_params_name.link_href = href; + style_params_name.is_link = true; msg_text->appendText(str_sender, FALSE, style_params_name); } + else + { + msg_text->appendText(str_sender, false); + } } //append text -- cgit v1.2.3