summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
authorSamuel Kolb <skolb@lindenlab.com>2009-11-30 09:11:04 -0800
committerSamuel Kolb <skolb@lindenlab.com>2009-11-30 09:11:04 -0800
commite2699c64a20262f6fbe6c1432294e8428e8cda5d (patch)
tree5b14a249342021b220df723a91c3e78d2c91f06e /indra/newview/llchathistory.cpp
parent6824800fa0001cd4a23a4f98b099af34435b0e06 (diff)
parentd4e01315e3f39dd14bb2c14f09e4e94749542b06 (diff)
merge viewer-2-0 into media
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r--indra/newview/llchathistory.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 2c9b38b82a..caf9c08057 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -199,7 +199,7 @@ public:
userName->setValue(SL);
}
- setTimeField(chat.mTimeStr);
+ setTimeField(chat);
LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
@@ -267,11 +267,29 @@ protected:
}
private:
- void setTimeField(const std::string& time_value)
+ std::string appendTime(const LLChat& chat)
+ {
+ time_t utc_time;
+ utc_time = time_corrected();
+ std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
+ +LLTrans::getString("TimeMin")+"] ";
+
+ LLSD substitution;
+
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+
+ return timeStr;
+ }
+
+ void setTimeField(const LLChat& chat)
{
LLTextBox* time_box = getChild<LLTextBox>("time_box");
LLRect rect_before = time_box->getRect();
+
+ std::string time_value = appendTime(chat);
+
time_box->setValue(time_value);
// set necessary textbox width to fit all text
@@ -386,7 +404,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_
p.left_pad = mLeftWidgetPad;
p.right_pad = mRightWidgetPad;
- if (mLastFromName == chat.mFromName)
+ LLDate new_message_time = LLDate::now();
+
+ if (mLastFromName == chat.mFromName &&
+ mLastMessageTime.notNull() &&
+ (new_message_time.secondsSinceEpoch() - mLastMessageTime.secondsSinceEpoch()) < 60.0 )
{
view = getSeparator();
p.top_pad = mTopSeparatorPad;
@@ -414,6 +436,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_
appendWidget(p, header_text, false);
mLastFromName = chat.mFromName;
+ mLastMessageTime = new_message_time;
}
//Handle IRC styled /me messages.
std::string prefix = chat.mText.substr(0, 4);