summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp94
1 files changed, 45 insertions, 49 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 9153f7325f..c0c9ea1451 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -138,10 +138,7 @@ public:
if (level == "profile")
{
- LLSD params;
- params["object_id"] = getAvatarId();
-
- LLFloaterReg::showInstance("inspect_object", params);
+ LLFloaterReg::showInstance("inspect_remote_object", mObjectData);
}
else if (level == "block")
{
@@ -229,7 +226,7 @@ public:
if (mSourceType == CHAT_SOURCE_OBJECT)
{
- LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", mAvatarID));
+ LLFloaterReg::showInstance("inspect_remote_object", mObjectData);
}
else if (mSourceType == CHAT_SOURCE_AGENT)
{
@@ -251,7 +248,7 @@ public:
const LLUUID& getAvatarId () const { return mAvatarID;}
- void setup(const LLChat& chat,const LLStyle::Params& style_params)
+ void setup(const LLChat& chat, const LLStyle::Params& style_params, const LLSD& args)
{
mAvatarID = chat.mFromID;
mSessionID = chat.mSessionID;
@@ -332,7 +329,8 @@ public:
setTimeField(chat);
-
+
+ // Set up the icon.
LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
if(mSourceType != CHAT_SOURCE_AGENT || mAvatarID.isNull())
@@ -352,6 +350,30 @@ public:
case CHAT_SOURCE_UNKNOWN:
icon->setValue(LLSD("Unknown_Icon"));
}
+
+ // In case the message came from an object, save the object info
+ // to be able properly show its profile.
+ if ( chat.mSourceType == CHAT_SOURCE_OBJECT)
+ {
+ 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();
+ }
+ }
+
+ LLSD payload;
+ payload["object_id"] = chat.mFromID;
+ payload["name"] = chat.mFromName;
+ payload["owner_id"] = chat.mOwnerID;
+ payload["slurl"] = LLWeb::escapeURL(slurl);
+
+ mObjectData = payload;
+ }
}
/*virtual*/ void draw()
@@ -540,6 +562,7 @@ protected:
static LLUICtrl* sInfoCtrl;
LLUUID mAvatarID;
+ LLSD mObjectData;
EChatSourceType mSourceType;
std::string mFrom;
LLUUID mSessionID;
@@ -586,7 +609,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
LLLayoutStack::Params layout_p;
layout_p.rect = stack_rect;
layout_p.follows.flags = FOLLOWS_ALL;
- layout_p.orientation = "vertical";
+ layout_p.orientation = LLLayoutStack::VERTICAL;
layout_p.mouse_opaque = false;
LLLayoutStack* stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p, this);
@@ -649,10 +672,10 @@ LLView* LLChatHistory::getSeparator()
return separator;
}
-LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params)
+LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args)
{
LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
- header->setup(chat,style_params);
+ header->setup(chat, style_params, args);
return header;
}
@@ -770,41 +793,31 @@ 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)
LLStyle::Params link_params(style_params);
- link_params.color.control = "HTMLLinkColor";
+ LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ link_params.color = link_color;
+ link_params.readonly_color = link_color;
+ link_params.is_link = true;
link_params.link_href = url;
- mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter,
+
+ mEditor->appendText(chat.mFromName + delimiter,
false, link_params);
}
else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log)
{
LLStyle::Params link_params(style_params);
link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));
+
// Add link to avatar's inspector and delimiter to message.
- mEditor->appendText(link_params.link_href, false, style_params);
- mEditor->appendText(delimiter, false, style_params);
+ mEditor->appendText(std::string(link_params.link_href) + delimiter, false, link_params);
}
else
{
- mEditor->appendText(chat.mFromName + delimiter, false, style_params);
+ mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter, false, style_params);
}
}
}
@@ -830,7 +843,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
else
{
- view = getHeader(chat, style_params);
+ view = getHeader(chat, style_params, args);
if (mEditor->getText().size() == 0)
p.top_pad = 0;
else
@@ -895,31 +908,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
}
- LLTextEditor* text_editor = notify_box->getChild<LLTextEditor>("text_editor_box", TRUE);
- S32 text_heigth = 0;
- if(text_editor != NULL)
- {
- text_heigth = text_editor->getTextBoundingRect().getHeight();
- }
-
//Prepare the rect for the view
LLRect target_rect = mEditor->getDocumentView()->getRect();
// squeeze down the widget by subtracting padding off left and right
target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
target_rect.mRight -= mRightWidgetPad;
- notify_box->reshape(target_rect.getWidth(),
- notify_box->getRect().getHeight());
+ notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight());
notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
- if (text_editor != NULL)
- {
- S32 text_heigth_delta =
- text_editor->getTextBoundingRect().getHeight()
- - text_heigth;
- notify_box->reshape(target_rect.getWidth(),
- notify_box->getRect().getHeight() + text_heigth_delta);
- }
-
LLInlineViewSegment::Params params;
params.view = notify_box;
params.left_pad = mLeftWidgetPad;