diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-03-04 19:35:31 -0800 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-03-04 19:35:31 -0800 |
commit | 49319a90ef1fcca590e077805d5aaa65322a1a6d (patch) | |
tree | 309516485d4f202012871d81246848594cce55c6 /indra/newview | |
parent | 3d1ec8b462bc091e9d63c385ec0bc595937f31c5 (diff) |
CHUI-778: Now when delete transcripts is pressed the backup files will be deleted as well. Also if clear logs is pressed then backup logs will be cleared.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llconversationlog.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llconversationlog.h | 2 | ||||
-rw-r--r-- | indra/newview/lllogchat.cpp | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 4be169e267..dd20ca15ae 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -28,9 +28,11 @@ #include "llagent.h" #include "llavatarnamecache.h" #include "llconversationlog.h" +#include "lldiriterator.h" #include "llnotificationsutil.h" #include "lltrans.h" +#include <boost/foreach.hpp> #include "boost/lexical_cast.hpp" const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec @@ -380,6 +382,36 @@ void LLConversationLog::cache() } } +void LLConversationLog::getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs) +{ + // get Users log directory + std::string dirname = gDirUtilp->getPerAccountChatLogsDir(); + + // add final OS dependent delimiter + dirname += gDirUtilp->getDirDelimiter(); + + // create search pattern + std::string pattern = "conversation.log.backup*"; + + LLDirIterator iter(dirname, pattern); + std::string filename; + while (iter.next(filename)) + { + list_of_backup_logs.push_back(gDirUtilp->add(dirname, filename)); + } +} + +void LLConversationLog::deleteBackupLogs() +{ + std::vector<std::string> backup_logs; + getListOfBackupLogs(backup_logs); + + BOOST_FOREACH(const std::string& fullpath, backup_logs) + { + LLFile::remove(fullpath); + } +} + bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory) { @@ -575,5 +607,6 @@ void LLConversationLog::onClearLogResponse(const LLSD& notification, const LLSD& mConversations.clear(); notifyObservers(); cache(); + deleteBackupLogs(); } } diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 58e698de25..265b1f0ef0 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -138,6 +138,8 @@ public: */ void cache(); bool moveLog(const std::string &originDirectory, const std::string &targetDirectory); + void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs); + void deleteBackupLogs(); void onClearLog(); void onClearLogResponse(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 448100c5d6..7f4b925b53 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -453,7 +453,7 @@ void LLLogChat::getListOfTranscriptFiles(std::vector<std::string>& list_of_trans dirname += gDirUtilp->getDirDelimiter(); // create search pattern - std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION; + std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION + "*"; LLDirIterator iter(dirname, pattern); std::string filename; |