diff options
author | Richard Linden <none@none> | 2013-11-06 17:22:04 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2013-11-06 17:22:04 -0800 |
commit | fe518bde8e6db65d3d6b178c200410b1346639a4 (patch) | |
tree | d738e12f8391a675d36aae9d59ced8104846008c /indra/newview/llconversationlog.cpp | |
parent | ea1e1b0925b386cf83178539b8eae9e25c573548 (diff) | |
parent | d9d46d908c0573dbcd45ec2a1bea56966823343b (diff) |
merge with release
Diffstat (limited to 'indra/newview/llconversationlog.cpp')
-rwxr-xr-x | indra/newview/llconversationlog.cpp | 82 |
1 files changed, 39 insertions, 43 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 7883e4cb89..03b1f14a03 100755 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -35,23 +35,18 @@ #include <boost/foreach.hpp> #include "boost/lexical_cast.hpp" -const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec - -struct ConversationParams -{ - ConversationParams(time_t time) - : mTime(time), - mTimestamp(LLConversation::createTimestamp(time)) - {} - - time_t mTime; - std::string mTimestamp; - SessionType mConversationType; - std::string mConversationName; - std::string mHistoryFileName; - LLUUID mSessionID; - LLUUID mParticipantID; - bool mHasOfflineIMs; +const S32Days CONVERSATION_LIFETIME = (S32Days)30; // lifetime of LLConversation is 30 days by spec + +struct ConversationParams : public LLInitParam::Block<ConversationParams> +{ + Mandatory<U64Seconds > time; + Mandatory<std::string> timestamp; + Mandatory<SessionType> conversation_type; + Mandatory<std::string> conversation_name, + history_filename; + Mandatory<LLUUID> session_id, + participant_id; + Mandatory<bool> has_offline_ims; }; /************************************************************************/ @@ -59,14 +54,14 @@ struct ConversationParams /************************************************************************/ LLConversation::LLConversation(const ConversationParams& params) -: mTime(params.mTime), - mTimestamp(params.mTimestamp), - mConversationType(params.mConversationType), - mConversationName(params.mConversationName), - mHistoryFileName(params.mHistoryFileName), - mSessionID(params.mSessionID), - mParticipantID(params.mParticipantID), - mHasOfflineIMs(params.mHasOfflineIMs) +: mTime(params.time), + mTimestamp(params.timestamp), + mConversationType(params.conversation_type), + mConversationName(params.conversation_name), + mHistoryFileName(params.history_filename), + mSessionID(params.session_id), + mParticipantID(params.participant_id), + mHasOfflineIMs(params.has_offline_ims) { setListenIMFloaterOpened(); } @@ -105,7 +100,7 @@ LLConversation::~LLConversation() void LLConversation::updateTimestamp() { - mTime = time_corrected(); + mTime = (U64Seconds)time_corrected(); mTimestamp = createTimestamp(mTime); } @@ -118,11 +113,11 @@ void LLConversation::onIMFloaterShown(const LLUUID& session_id) } // static -const std::string LLConversation::createTimestamp(const time_t& utc_time) +const std::string LLConversation::createTimestamp(const U64Seconds& utc_time) { std::string timeStr; LLSD substitution; - substitution["datetime"] = (S32) utc_time; + substitution["datetime"] = (S32)utc_time.value(); timeStr = "["+LLTrans::getString ("TimeMonth")+"]/[" +LLTrans::getString ("TimeDay")+"]/[" @@ -135,10 +130,10 @@ const std::string LLConversation::createTimestamp(const time_t& utc_time) return timeStr; } -bool LLConversation::isOlderThan(U32 days) const +bool LLConversation::isOlderThan(U32Days days) const { - time_t now = time_corrected(); - U32 age = (U32)((now - mTime) / SEC_PER_DAY); // age of conversation in days + U64Seconds now(time_corrected()); + U32Days age = now - mTime; return age > days; } @@ -460,14 +455,14 @@ bool LLConversationLog::saveToFile(const std::string& filename) { if (!filename.size()) { - llwarns << "Call log list filename is empty!" << llendl; + LL_WARNS() << "Call log list filename is empty!" << LL_ENDL; return false; } LLFILE* fp = LLFile::fopen(filename, "wb"); if (!fp) { - llwarns << "Couldn't open call log list" << filename << llendl; + LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL; return false; } @@ -485,7 +480,7 @@ bool LLConversationLog::saveToFile(const std::string& filename) // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a| fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n", - (S64)conv_it->getTime(), + (S64)conv_it->getTime().value(), (S32)conv_it->getConversationType(), (S32)0, (S32)conv_it->hasOfflineMessages(), @@ -501,14 +496,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename) { if(!filename.size()) { - llwarns << "Call log list filename is empty!" << llendl; + LL_WARNS() << "Call log list filename is empty!" << LL_ENDL; return false; } LLFILE* fp = LLFile::fopen(filename, "rb"); if (!fp) { - llwarns << "Couldn't open call log list" << filename << llendl; + LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL; return false; } @@ -539,13 +534,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename) conv_id_buffer, history_file_name); - ConversationParams params((time_t)time); - params.mConversationType = (SessionType)stype; - params.mHasOfflineIMs = has_offline_ims; - params.mConversationName = std::string(conv_name_buffer); - params.mParticipantID = LLUUID(part_id_buffer); - params.mSessionID = LLUUID(conv_id_buffer); - params.mHistoryFileName = std::string(history_file_name); + ConversationParams params; + params.time(LLUnits::Seconds::fromValue(time)) + .conversation_type((SessionType)stype) + .has_offline_ims(has_offline_ims) + .conversation_name(conv_name_buffer) + .participant_id(LLUUID(part_id_buffer)) + .session_id(LLUUID(conv_id_buffer)) + .history_filename(history_file_name); LLConversation conversation(params); |