summaryrefslogtreecommitdiff
path: root/indra/newview/llchathistory.cpp
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2009-11-26 12:58:14 +0200
committerYuri Chebotarev <ychebotarev@productengine.com>2009-11-26 12:58:14 +0200
commitb884eede5126309bcb1742555ea14308efaa9f20 (patch)
tree5aebab373577386d7a2845fd1d29739f2dcf0509 /indra/newview/llchathistory.cpp
parent4c81e7a85c3fe69f16ac3996df732627dda8533a (diff)
EXT-2831 Timestamps are missing in nearby chat toasts
--HG-- branch : product-engine
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);