STORM-1021 : pull into viewer-development

master
Merov Linden 2011-03-25 16:43:49 -07:00
commit b7b9a37bc1
5 changed files with 53 additions and 27 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
};