diff options
author | Merov Linden <merov@lindenlab.com> | 2011-03-25 16:43:49 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2011-03-25 16:43:49 -0700 |
commit | b7b9a37bc13d40a3caf7ea77d6857c2bb6036e06 (patch) | |
tree | 31b49f69a8661b85cc29324e565ddf76c701139b | |
parent | fbb280d84e2b960cfb68e39c251878329b4f4fce (diff) | |
parent | df450ff17b7a6bb27049f6f462e75fe0763644c3 (diff) |
STORM-1021 : pull into viewer-development
-rw-r--r-- | indra/newview/llchathistory.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llchatitemscontainerctrl.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llnearbychathandler.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerchat.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llviewerchat.h | 4 |
5 files changed, 53 insertions, 27 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d4ec377e03..c0c9ea1451 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -793,21 +793,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull()) { // for object IMs, create a secondlife:///app/objectim SLapp - std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); - url += "?name=" + chat.mFromName; - url += "&owner=" + chat.mOwnerID.asString(); - - std::string slurl = args["slurl"].asString(); - if (slurl.empty()) - { - LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); - if(region) - { - LLSLURL region_slurl(region->getName(), chat.mPosAgent); - slurl = region_slurl.getLocationString(); - } - } - url += "&slurl=" + LLURI::escape(slurl); + std::string url = LLViewerChat::getSenderSLURL(chat, args); // set the link for the object name to be the objectim SLapp // (don't let object names with hyperlinks override our objectim Url) diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 899e0431e7..8584885bc9 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -213,17 +213,6 @@ void LLNearbyChatToastPanel::init(LLSD& notification) { LLStyle::Params style_params_name; - std::string href; - - if (mSourceType == CHAT_SOURCE_AGENT) - { - href = LLSLURL("agent", mFromID, "about").getSLURLString(); - } - else - { - href = LLSLURL("object", mFromID, "inspect").getSLURLString(); - } - LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); style_params_name.color(user_name_color); @@ -232,7 +221,7 @@ 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 = href; + style_params_name.link_href = notification["sender_slurl"].asString(); style_params_name.is_link = true; msg_text->appendText(str_sender, FALSE, style_params_name); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index de5439e4e0..0d9daeb44e 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -558,6 +558,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) } */ + // Add a nearby chat toast. LLUUID id; id.generate(); @@ -583,6 +584,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; + + // Pass sender info so that it can be rendered properly (STORM-1021). + notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); + channel->addNotification(notification); } diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 0af850a46b..286b16bab2 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -31,6 +31,8 @@ #include "llagent.h" // gAgent #include "lluicolortable.h" #include "llviewercontrol.h" // gSavedSettings +#include "llviewerregion.h" +#include "llworld.h" #include "llinstantmessage.h" //SYSTEM_FROM // LLViewerChat @@ -214,3 +216,43 @@ void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg) } +//static +std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args) +{ + switch (chat.mSourceType) + { + case CHAT_SOURCE_AGENT: + return LLSLURL("agent", chat.mFromID, "about").getSLURLString(); + + case CHAT_SOURCE_OBJECT: + return getObjectImSLURL(chat, args); + + default: + llwarns << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << llendl; + } + + return LLStringUtil::null; +} + +//static +std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args) +{ + std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); + url += "?name=" + chat.mFromName; + url += "&owner=" + chat.mOwnerID.asString(); + + std::string slurl = args["slurl"].asString(); + if (slurl.empty()) + { + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); + if(region) + { + LLSLURL region_slurl(region->getName(), chat.mPosAgent); + slurl = region_slurl.getLocationString(); + } + } + + url += "&slurl=" + LLURI::escape(slurl); + + return url; +} diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h index a9f9a98960..0f15d29f04 100644 --- a/indra/newview/llviewerchat.h +++ b/indra/newview/llviewerchat.h @@ -40,6 +40,10 @@ public: static LLFontGL* getChatFont(); static S32 getChatFontSize(); static void formatChatMsg(const LLChat& chat, std::string& formated_msg); + static std::string getSenderSLURL(const LLChat& chat, const LLSD& args); + +private: + static std::string getObjectImSLURL(const LLChat& chat, const LLSD& args); }; |