CHUI-325 FIXED (Cap conversation log to 30 days, purge older data on login)
- Remove conversations older than 30 days from call logmeow-7.2.2
parent
3cf624b371
commit
42dbf23dc5
|
|
@ -30,6 +30,8 @@
|
|||
#include "llconversationlog.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec
|
||||
|
||||
struct Conversation_params
|
||||
{
|
||||
Conversation_params(time_t time)
|
||||
|
|
@ -139,6 +141,14 @@ const std::string LLConversation::createTimestamp(const time_t& utc_time)
|
|||
return timeStr;
|
||||
}
|
||||
|
||||
bool LLConversation::isOlderThan(U32 days) const
|
||||
{
|
||||
time_t now = time_corrected();
|
||||
U32 age = (U32)((now - mTime) / SEC_PER_DAY); // age of conversation in days
|
||||
|
||||
return age > days;
|
||||
}
|
||||
|
||||
void LLConversation::setListenIMFloaterOpened()
|
||||
{
|
||||
LLIMFloater* floater = LLIMFloater::findInstance(mSessionID);
|
||||
|
|
@ -394,10 +404,22 @@ bool LLConversationLog::loadFromFile(const std::string& filename)
|
|||
params.mHistoryFileName = std::string(history_file_name);
|
||||
|
||||
LLConversation conversation(params);
|
||||
|
||||
// CHUI-325
|
||||
// The conversation log should be capped to the last 30 days. Conversations with the last utterance
|
||||
// being over 30 days old should be purged from the conversation log text file on login.
|
||||
if (conversation.isOlderThan(CONVERSATION_LIFETIME))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mConversations.push_back(conversation);
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
LLFile::remove(filename);
|
||||
cache();
|
||||
|
||||
notifyObservers();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public:
|
|||
void setIsPast (bool is_past) { mIsConversationPast = is_past; }
|
||||
void setConverstionName(std::string conv_name) { mConversationName = conv_name; }
|
||||
|
||||
bool isOlderThan(U32 days) const;
|
||||
|
||||
/*
|
||||
* Resets flag of unread offline message to false when im floater with this conversation is opened.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue