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.cpp75
1 files changed, 38 insertions, 37 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 81cc52528c..6180b880b5 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -66,8 +66,6 @@ static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history");
const static std::string NEW_LINE(rawstr_to_utf8("\n"));
-const static U32 LENGTH_OF_TIME_STR = std::string("12:00").length();
-
const static std::string SLURL_APP_AGENT = "secondlife:///app/agent/";
const static std::string SLURL_ABOUT = "/about";
@@ -122,7 +120,7 @@ public:
BOOL handleToolTip(S32 x, S32 y, MASK mask)
{
LLTextBase* name = getChild<LLTextBase>("user_name");
- if (name && name->parentPointInView(x, y) && mAvatarID.notNull() && SYSTEM_FROM != mFrom)
+ if (name && name->parentPointInView(x, y) && mAvatarID.notNull() && mFrom.size() && SYSTEM_FROM != mFrom)
{
// Spawn at right side of the name textbox.
@@ -179,12 +177,7 @@ public:
}
else if (level == "add")
{
- std::string name;
- name.assign(getFirstName());
- name.append(" ");
- name.append(getLastName());
-
- LLAvatarActions::requestFriendshipDialog(getAvatarId(), name);
+ LLAvatarActions::requestFriendshipDialog(getAvatarId(), mFrom);
}
else if (level == "remove")
{
@@ -253,8 +246,6 @@ public:
}
const LLUUID& getAvatarId () const { return mAvatarID;}
- const std::string& getFirstName() const { return mFirstName; }
- const std::string& getLastName () const { return mLastName; }
void setup(const LLChat& chat,const LLStyle::Params& style_params)
{
@@ -264,7 +255,7 @@ public:
gCacheName->get(mAvatarID, FALSE, boost::bind(&LLChatHistoryHeader::nameUpdatedCallback, this, _1, _2, _3, _4));
//*TODO overly defensive thing, source type should be maintained out there
- if(chat.mFromID.isNull() || chat.mFromName == SYSTEM_FROM)
+ if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM)
{
mSourceType = CHAT_SOURCE_SYSTEM;
}
@@ -275,9 +266,11 @@ public:
userName->setColor(style_params.color());
userName->setValue(chat.mFromName);
+ mFrom = chat.mFromName;
if (chat.mFromName.empty() || CHAT_SOURCE_SYSTEM == mSourceType)
{
- userName->setValue(LLTrans::getString("SECOND_LIFE"));
+ mFrom = LLTrans::getString("SECOND_LIFE");
+ userName->setValue(mFrom);
}
@@ -337,8 +330,7 @@ public:
{
if (id != mAvatarID)
return;
- mFirstName = first;
- mLastName = last;
+ mFrom = first + " " + last;
}
protected:
static const S32 PADDING = 20;
@@ -423,8 +415,6 @@ protected:
LLUUID mAvatarID;
EChatSourceType mSourceType;
- std::string mFirstName;
- std::string mLastName;
std::string mFrom;
LLUUID mSessionID;
@@ -443,7 +433,8 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
mTopSeparatorPad(p.top_separator_pad),
mBottomSeparatorPad(p.bottom_separator_pad),
mTopHeaderPad(p.top_header_pad),
- mBottomHeaderPad(p.bottom_header_pad)
+ mBottomHeaderPad(p.bottom_header_pad),
+ mIsLastMessageFromLog(false)
{
LLTextEditor::Params editor_params(p);
editor_params.rect = getLocalRect();
@@ -610,8 +601,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
style_params.font.style = "ITALIC";
}
- //*HACK we graying out chat history by graying out messages that contains full date in a time string
- bool message_from_log = chat.mTimeStr.length() > LENGTH_OF_TIME_STR;
+ bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY;
+ // We graying out chat history by graying out messages that contains full date in a time string
if (message_from_log)
{
style_params.color(LLColor4::grey);
@@ -680,7 +671,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
&& mLastFromID == chat.mFromID
&& mLastMessageTime.notNull()
&& (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0
- && mLastMessageTimeStr.size() == chat.mTimeStr.size()) //*HACK to distinguish between current and previous chat session's histories
+ && mIsLastMessageFromLog == message_from_log) //distinguish between current and previous chat session's histories
{
view = getSeparator();
p.top_pad = mTopSeparatorPad;
@@ -714,7 +705,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
mLastFromName = chat.mFromName;
mLastFromID = chat.mFromID;
mLastMessageTime = new_message_time;
- mLastMessageTimeStr = chat.mTimeStr;
+ mIsLastMessageFromLog = message_from_log;
}
if (chat.mNotifId.notNull())
@@ -729,22 +720,26 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
notify_box->setFollowsRight();
notify_box->setFollowsTop();
- LLButton* accept_button = notify_box->getChild<LLButton> ("Accept",
- TRUE);
- if (accept_button != NULL)
- {
- accept_button->setFollowsNone();
- accept_button->setOrigin(2*HPAD, accept_button->getRect().mBottom);
- }
-
- LLButton* decline_button = notify_box->getChild<LLButton> (
- "Decline", TRUE);
- if (accept_button != NULL && decline_button != NULL)
+ ctrl_list_t ctrls = notify_box->getControlPanel()->getCtrlList();
+ S32 offset = 0;
+ for (ctrl_list_t::iterator it = ctrls.begin(); it != ctrls.end(); it++)
{
- decline_button->setFollowsNone();
- decline_button->setOrigin(4*HPAD
- + accept_button->getRect().getWidth(),
- decline_button->getRect().mBottom);
+ LLButton * button = dynamic_cast<LLButton*> (*it);
+ if (button != NULL)
+ {
+ button->setOrigin( offset,
+ button->getRect().mBottom);
+ button->setLeftHPad(2 * HPAD);
+ button->setRightHPad(2 * HPAD);
+ // set zero width before perform autoResize()
+ button->setRect(LLRect(button->getRect().mLeft,
+ button->getRect().mTop, button->getRect().mLeft,
+ button->getRect().mBottom));
+ button->setAutoResize(true);
+ button->autoResize();
+ offset += 2 * HPAD + button->getRect().getWidth();
+ button->setFollowsNone();
+ }
}
LLTextEditor* text_editor = notify_box->getChild<LLTextEditor>("text_editor_box", TRUE);
@@ -796,6 +791,12 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
}
}
+ if (irc_me && !use_plain_text_chat_history)
+ {
+ message = chat.mFromName + message;
+ }
+
+
mEditor->appendText(message, FALSE, style_params);
}
mEditor->blockUndo();