summaryrefslogtreecommitdiff
path: root/indra/newview/llconversationlog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llconversationlog.cpp')
-rwxr-xr-xindra/newview/llconversationlog.cpp86
1 files changed, 41 insertions, 45 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 7883e4cb89..05c7e6caa5 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.isProvided() ? params.timestamp : createTimestamp(params.time)),
+ 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();
}
@@ -77,7 +72,7 @@ LLConversation::LLConversation(const LLIMModel::LLIMSession& session)
mConversationType(session.mSessionType),
mConversationName(session.mName),
mHistoryFileName(session.mHistoryFileName),
- mSessionID(session.isOutgoingAdHoc() ? session.generateOutgouigAdHocHash() : session.mSessionID),
+ mSessionID(session.isOutgoingAdHoc() ? session.generateOutgoingAdHocHash() : session.mSessionID),
mParticipantID(session.mOtherParticipantID),
mHasOfflineIMs(session.mHasOfflineMessage)
{
@@ -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;
}
@@ -318,7 +313,7 @@ LLConversation* LLConversationLog::findConversation(const LLIMModel::LLIMSession
{
if (session)
{
- const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID;
+ const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgoingAdHocHash() : session->mSessionID;
conversations_vec_t::iterator conv_it = mConversations.begin();
for(; conv_it != mConversations.end(); ++conv_it)
@@ -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);