From e563a07659b74b2dca850834a44c3b92ff993b44 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Tue, 2 Feb 2010 17:19:14 +0000 Subject: DEV-32540: Lots of object IM and SLurl improvements - Don't let object names that are URLs override links to display the remote object inspector - Don't hyperlink the object name in the remote object inspector - Made the ... regex more robust and made it support non-URLs between the tags, so that we don't get random tags when trying to disable URLs in user-typed text. - Improved the llurlentry unit test and added some more test cases. - Hooked up another LLViewerMessage code path to objectim SLapps to pass down the owner and slurl information. - Made a few LLUrlEntryBase methods be const methods, because they are - Fixed a bug in the remote object inspector where it would never show the teleport URL. --- indra/newview/llchathistory.cpp | 19 +++++++++++++------ indra/newview/llinspectremoteobject.cpp | 5 +++-- indra/newview/llviewermessage.cpp | 5 ++++- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 581c210bd5..7c22ac9e36 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -579,19 +579,26 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL url += "?name=" + chat.mFromName; url += "&owner=" + args["owner_id"].asString(); - LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); - if (region) + std::string slurl = args["slurl"].asString(); + if (slurl.empty()) { - S32 x, y, z; - LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z); - url += "&slurl=" + region->getName() + llformat("/%d/%d/%d", x, y, z); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); + if (region) + { + S32 x, y, z; + LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z); + slurl = region->getName() + llformat("/%d/%d/%d", x, y, z); + } } + url += "&slurl=" + slurl; // set the link for the object name to be the objectim SLapp + // (don't let object names with hyperlinks override our objectim Url) LLStyle::Params link_params(style_params); link_params.color.control = "HTMLLinkColor"; link_params.link_href = url; - mEditor->appendText(chat.mFromName + delimiter, false, link_params); + mEditor->appendText("" + chat.mFromName + "" + delimiter, + false, link_params); } else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() ) { diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp index 898f1cd9ac..66e4a1bf66 100644 --- a/indra/newview/llinspectremoteobject.cpp +++ b/indra/newview/llinspectremoteobject.cpp @@ -167,7 +167,8 @@ void LLInspectRemoteObject::nameCallback(const LLUUID& id, const std::string& fi void LLInspectRemoteObject::update() { // show the object name as the inspector's title - getChild("object_name")->setValue(mName); + // (don't hyperlink URLs in object names) + getChild("object_name")->setValue("" + mName + ""); // show the object's owner - click it to show profile std::string owner = mOwner; @@ -192,7 +193,7 @@ void LLInspectRemoteObject::update() std::string url; if (! mSLurl.empty()) { - std::string url = "secondlife:///app/teleport/" + mSLurl; + url = "secondlife:///app/teleport/" + mSLurl; } getChild("object_slurl")->setValue(url); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b0952dd698..aa9d0f469d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2189,7 +2189,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat", LLSD()); if(nearby_chat) { - nearby_chat->addMessage(chat); + LLSD args; + args["owner_id"] = from_id; + args["slurl"] = location; + nearby_chat->addMessage(chat, true, args); } -- cgit v1.2.3