diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-09-13 11:23:37 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2012-09-13 11:23:37 -0700 |
commit | 6b597ad40dcec2f494988eddf76376ae439c1059 (patch) | |
tree | db15452f572d5c0ca39ba7e9f82e23c86573b8b7 /indra/newview | |
parent | 2084d33c1ec827b4e8d975a3bf1232e971f704e2 (diff) | |
parent | a6370cf4a72371e090d45f2a147929d016f42780 (diff) |
merging in latest changes
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llconversationlog.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llconversationlog.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloaterconversationlog.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloaterconversationlog.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterconversationpreview.cpp | 6 | ||||
-rwxr-xr-x | indra/newview/llimfloatercontainer.cpp | 21 | ||||
-rw-r--r-- | indra/newview/lllogchat.cpp | 17 | ||||
-rw-r--r-- | indra/newview/lllogchat.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_conversation_log.xml | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_container.xml | 2 |
11 files changed, 82 insertions, 33 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4dacde4792..08a1a237f5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1834,10 +1834,7 @@ bool LLAppViewer::cleanup() LLMuteList::getInstance()->cache(gAgent.getID()); //save call log list - if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) - { - LLConversationLog::instance().cache(); - } + LLConversationLog::instance().cache(); if (mPurgeOnExit) { 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; diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index ffd27f7e20..a458e975bb 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -144,6 +144,8 @@ private: LLConversationLog(); + void enableLogging(bool enable); + /** * adds conversation to the conversation list and notifies observers */ @@ -151,8 +153,6 @@ private: void notifyPrticularConversationObservers(const LLUUID& session_id, U32 mask); - void observeIMSession(); - /** * constructs file name in which conversations log will be saved * file name is conversation.log diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp index 7b4c999e52..089aec1905 100644 --- a/indra/newview/llfloaterconversationlog.cpp +++ b/indra/newview/llfloaterconversationlog.cpp @@ -63,6 +63,13 @@ BOOL LLFloaterConversationLog::postBuild() getChild<LLFilterEditor>("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterConversationLog::onFilterEdit, this, _2)); + LLControlVariable* ctrl = gSavedPerAccountSettings.getControl("LogInstantMessages").get(); + if (ctrl) + { + ctrl->getSignal()->connect(boost::bind(&LLFloaterConversationLog::onCallLoggingEnabledDisabled, this, _2)); + onCallLoggingEnabledDisabled(ctrl->getValue().asBoolean()); + } + return LLFloater::postBuild(); } @@ -130,3 +137,9 @@ bool LLFloaterConversationLog::isActionChecked(const LLSD& userdata) return false; } + +void LLFloaterConversationLog::onCallLoggingEnabledDisabled(bool enabled) +{ + std::string no_items_msg = enabled ? "" : getString("logging_calls_disabled"); + mConversationLogList->setNoItemsCommentText(no_items_msg); +} diff --git a/indra/newview/llfloaterconversationlog.h b/indra/newview/llfloaterconversationlog.h index e971330f3d..9e79cbd7d8 100644 --- a/indra/newview/llfloaterconversationlog.h +++ b/indra/newview/llfloaterconversationlog.h @@ -49,6 +49,8 @@ private: bool isActionEnabled(const LLSD& userdata); bool isActionChecked(const LLSD& userdata); + void onCallLoggingEnabledDisabled(bool enabled); + LLConversationLogList* mConversationLogList; }; diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index dbcf154ef2..88efc39764 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -65,7 +65,11 @@ BOOL LLFloaterConversationPreview::postBuild() std::string title = getString("Title", args); setTitle(title); - LLLogChat::loadChatHistory(file, mMessages, true); + LLSD load_params; + load_params["load_all_history"] = true; + load_params["cut_off_todays_date"] = false; + + LLLogChat::loadChatHistory(file, mMessages, load_params); mCurrentPage = mMessages.size() / mPageSize; mPageSpinner = getChild<LLSpinCtrl>("history_page_spin"); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 3243fd48de..9320117eb5 100755 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -118,7 +118,7 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild<LLPanel>("conversations_list_panel"); - // CHUI-98 : View Model for conversations + // Create the root model and view for all conversation sessions LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); LLFolderView::Params p; p.view_model = &mConversationViewModel; @@ -129,6 +129,8 @@ BOOL LLIMFloaterContainer::postBuild() p.root = NULL; mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p); + mConversationsRoot->setVisible(TRUE); + mConversationsListPanel->addChild(mConversationsRoot); addConversationListItem(LLUUID()); // manually add nearby chat @@ -370,8 +372,13 @@ void LLIMFloaterContainer::draw() } } - repositioningWidgets(); - + // CHUI-308 : Hack! We shouldn't have to do that but we have too as long as + // we don't have a scroll container. + // *TODO: Take those 3 lines out once we implement the scroll container. + repositioningWidgets(); + mConversationsRoot->setRect(mConversationsListPanel->getLocalRect()); + mConversationsRoot->setFollowsAll(); + if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user @@ -485,6 +492,13 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) setCanResize(is_left_pane_expanded || is_right_pane_expanded); setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); + // force set correct size for the title after show/hide minimize button + LLRect cur_rect = getRect(); + LLRect force_rect = cur_rect; + force_rect.mRight = cur_rect.mRight + 1; + setRect(force_rect); + setRect(cur_rect); + // restore floater's resize limits (prevent collapse when left panel is expanded) if (is_left_pane_expanded && !is_right_pane_expanded) { @@ -630,7 +644,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) widget->addToFolder(mConversationsRoot); // Add it to the UI - mConversationsListPanel->addChild(widget); widget->setVisible(TRUE); // Create the participants widgets now diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 073f5f00c5..3692658e9e 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -387,13 +387,16 @@ void append_to_last_message(std::list<LLSD>& messages, const std::string& line) } // static -void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, bool load_all_history/*= false*/) +void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params) { if (file_name.empty()) { llwarns << "Session name is Empty!" << llendl; return ; } + + bool load_all_history = load_params.has("load_all_history") ? load_params["load_all_history"].asBoolean() : false; + //LL_INFOS("") << "Loading:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ //LL_INFOS("") << "Current:" << makeLogFileName(file_name) << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ LLFILE* fptr = LLFile::fopen(makeLogFileName(file_name), "r");/*Flawfinder: ignore*/ @@ -449,7 +452,7 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m else { LLSD item; - if (!LLChatLogParser::parse(line, item)) + if (!LLChatLogParser::parse(line, item, load_params)) { item[IM_TEXT] = line; } @@ -500,10 +503,11 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const } } -bool LLChatLogParser::parse(std::string& raw, LLSD& im) +bool LLChatLogParser::parse(std::string& raw, LLSD& im, const LLSD& parse_params) { if (!raw.length()) return false; + bool cut_off_todays_date = parse_params.has("cut_off_todays_date") ? parse_params["cut_off_todays_date"].asBoolean() : true; im = LLSD::emptyMap(); //matching a timestamp @@ -518,7 +522,12 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im) boost::trim(timestamp); timestamp.erase(0, 1); timestamp.erase(timestamp.length()-1, 1); - LLLogChatTimeScanner::instance().checkAndCutOffDate(timestamp); + + if (cut_off_todays_date) + { + LLLogChatTimeScanner::instance().checkAndCutOffDate(timestamp); + } + im[IM_TIME] = timestamp; } else diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 95f83e64e5..d3e9adcc37 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -55,7 +55,7 @@ public: void (*callback)(ELogLineType, const LLSD&, void*), void* userdata); - static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, bool load_all_history = false); + static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params = LLSD()); private: static std::string cleanFileName(std::string filename); }; @@ -105,7 +105,7 @@ public: * * @return false if failed to parse mandatory data - message text */ - static bool parse(std::string& raw, LLSD& im); + static bool parse(std::string& raw, LLSD& im, const LLSD& parse_params = LLSD()); protected: LLChatLogParser(); diff --git a/indra/newview/skins/default/xui/en/floater_conversation_log.xml b/indra/newview/skins/default/xui/en/floater_conversation_log.xml index 9cdeb0d788..df78bbccec 100644 --- a/indra/newview/skins/default/xui/en/floater_conversation_log.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_log.xml @@ -13,6 +13,11 @@ reuse_instance="true" title="CONVERSATION LOG" width="450"> + + <string name="logging_calls_disabled"> + Conversations are not being logged. To log conversations in the future, select "Save IM logs in my computer" under Preferences > Privacy. + </string> + <panel follows="left|top|right" height="27" diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 1583add857..413e66738d 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -36,7 +36,7 @@ name="conversations_layout_panel" min_dim="38" width="268" - expanded_min_dim="165"> + expanded_min_dim="120"> <layout_stack animate="false" follows="left|top|right" |