From 9373f64f49ad9d0676731041466d353274ee51bd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 17 May 2022 22:14:26 +0300 Subject: SL-3007 Small improvements for auto filling abuse reports --- indra/newview/llchathistory.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index f286e4c075..5edc8a1291 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -406,8 +406,30 @@ public: } else if (level == "report_abuse") { - std::string time = getChild("time_box")->getValue().asString(); - LLFloaterReporter::showFromChat(mAvatarID, mFrom, time, mText); + std::string time_string; + if (mTime > 0) // have frame time + { + time_t current_time = time_corrected(); + time_t message_time = current_time - LLFrameTimer::getElapsedSeconds() + mTime; + + time_string = "[" + LLTrans::getString("TimeMonth") + "]/[" + + LLTrans::getString("TimeDay") + "]/[" + + LLTrans::getString("TimeYear") + "] [" + + LLTrans::getString("TimeHour") + "]:[" + + LLTrans::getString("TimeMin") + "]"; + + LLSD substitution; + + substitution["datetime"] = (S32)message_time; + LLStringUtil::format(time_string, substitution); + } + else + { + // From history. This might be not full. + // See LLChatLogParser::parse if it needs to include full date + time_string = getChild("time_box")->getValue().asString(); + } + LLFloaterReporter::showFromChat(mAvatarID, mFrom, time_string, mText); } else if(level == "block_unblock") { @@ -642,6 +664,7 @@ public: // and it's easier to store text directly than trying to get // it from a lltextsegment or chat's mEditor mText = chat.mText; + mTime = chat.mTime; //*TODO overly defensive thing, source type should be maintained out there if((chat.mFromID.isNull() && chat.mFromName.empty()) || (chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())) @@ -993,6 +1016,7 @@ protected: std::string mFrom; LLUUID mSessionID; std::string mText; + F64 mTime; S32 mMinUserNameWidth; const LLFontGL* mUserNameFont; -- cgit v1.2.3