diff options
author | Paul ProductEngine <pguslisty@productengine.com> | 2012-09-13 16:12:53 +0300 |
---|---|---|
committer | Paul ProductEngine <pguslisty@productengine.com> | 2012-09-13 16:12:53 +0300 |
commit | 8c0fcf0e391ff5db78f95f031562eedec998f164 (patch) | |
tree | fb3a02766a3c474ee75c95428df1e486aa3e564f /indra/newview/llconversationlog.cpp | |
parent | aa191cb98a80cd637b623f1dfb765374bf98dfa6 (diff) |
CHUI-321 FIXED (Indicate within the Call Log why there's nothing in it)
I. On "LogInstantMessages" variable set to false:
1. save call log to file
2. clear call log
3. show message: "Conversations are not being logged. To log conversations in the future, select "Save IM logs in my computer" under Preferences > Privacy."
On "LogInstantMessages" set to true:
1. clear message
2. reload all saved call log entries
II. Refactored the way LLConversationLog reacts on "LogInstantMessages" value change
Diffstat (limited to 'indra/newview/llconversationlog.cpp')
-rw-r--r-- | indra/newview/llconversationlog.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 239a89015f..27be2bc5ae 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -193,37 +193,40 @@ void LLConversationLogFriendObserver::changed(U32 mask) LLConversationLog::LLConversationLog() { - loadFromFile(getFileName()); - LLControlVariable* ctrl = gSavedPerAccountSettings.getControl("LogInstantMessages").get(); if (ctrl) { - ctrl->getSignal()->connect(boost::bind(&LLConversationLog::observeIMSession, this)); - + ctrl->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2)); if (ctrl->getValue().asBoolean()) { - LLIMMgr::instance().addSessionObserver(this); - newMessageSignalConnection = LLIMModel::instance().addNewMsgCallback(boost::bind(&LLConversationLog::onNewMessageReceived, this, _1)); + enableLogging(true); } } - - mFriendObserver = new LLConversationLogFriendObserver; - LLAvatarTracker::instance().addObserver(mFriendObserver); - } -void LLConversationLog::observeIMSession() +void LLConversationLog::enableLogging(bool enable) { - if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) + if (enable) { + loadFromFile(getFileName()); + LLIMMgr::instance().addSessionObserver(this); - LLIMModel::instance().addNewMsgCallback(boost::bind(&LLConversationLog::onNewMessageReceived, this, _1)); + newMessageSignalConnection = LLIMModel::instance().addNewMsgCallback(boost::bind(&LLConversationLog::onNewMessageReceived, this, _1)); + + mFriendObserver = new LLConversationLogFriendObserver; + LLAvatarTracker::instance().addObserver(mFriendObserver); } else { + saveToFile(getFileName()); + LLIMMgr::instance().removeSessionObserver(this); newMessageSignalConnection.disconnect(); + LLAvatarTracker::instance().removeObserver(mFriendObserver); + mConversations.clear(); } + + notifyObservers(); } void LLConversationLog::logConversation(const LLUUID& session_id) @@ -338,7 +341,10 @@ void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string void LLConversationLog::cache() { - saveToFile(getFileName()); + if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) + { + saveToFile(getFileName()); + } } std::string LLConversationLog::getFileName() @@ -349,7 +355,7 @@ std::string LLConversationLog::getFileName() bool LLConversationLog::saveToFile(const std::string& filename) { - if(!filename.size()) + if (!filename.size()) { llwarns << "Call log list filename is empty!" << llendl; return false; |