From c73947ac1fc6c48bca75ea7d6beeda63eb695b2b Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 18 Dec 2012 18:48:15 -0800 Subject: CHUI-499: Adding ability to serialize the communication notifications to local disk per user. --- indra/newview/llcommunicationchannel.cpp | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 indra/newview/llcommunicationchannel.cpp (limited to 'indra/newview/llcommunicationchannel.cpp') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp new file mode 100644 index 0000000000..353447e4b6 --- /dev/null +++ b/indra/newview/llcommunicationchannel.cpp @@ -0,0 +1,73 @@ +/** +* @file llcommunicationchannel.cpp +* @brief Implementation of llcommunicationchannel +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" // must be first include + +#include "llcommunicationchannel.h" + +#include +#include + +#include "llagent.h" +#include "lldate.h" +#include "llnotifications.h" + + +LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName) + : LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus) +{ +} + +LLCommunicationChannel::~LLCommunicationChannel() +{ +} + +bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) +{ + return !gAgent.isDoNotDisturb(); +} + +LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const +{ + return mHistory.begin(); +} + +LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::endHistory() const +{ + return mHistory.end(); +} + +void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr) +{ + std::string notificationType = pNotificationPtr->getType(); + if ((notificationType == "groupnotify") + || (notificationType == "offer") + || (notificationType == "notifytoast")) + { + mHistory.insert(std::make_pair(pNotificationPtr->getDate(), pNotificationPtr)); + } +} -- cgit v1.2.3 From bd6d34d312c3e3322ab62f3a60253fb88fcbc9e3 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Wed, 19 Dec 2012 01:48:37 -0800 Subject: CHUI-499: Loading the DND notifications upon exit from DND mode and after login. --- indra/newview/llcommunicationchannel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llcommunicationchannel.cpp') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 353447e4b6..4b0a70ffd8 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -39,6 +39,7 @@ LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName) : LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus) + , mHistory() { } @@ -61,6 +62,11 @@ LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::e return mHistory.end(); } +void LLCommunicationChannel::clearHistory() +{ + mHistory.clear(); +} + void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr) { std::string notificationType = pNotificationPtr->getType(); -- cgit v1.2.3 From 69497e645bbefe85d83e85bb353e5fb719263877 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 11 Jan 2013 18:20:29 -0800 Subject: CHUI-668: Not fully complete but as of this commit, have functionality to use the user's most intrusive chat notification upon exiting from DND mode with IM's. Also if in DND mode, clicking on a conversation line item or floater, will flush the DND notifications system of storing that conversation. This way upon existing DND mode already responded conversations won't be notified to the user. --- indra/newview/llcommunicationchannel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcommunicationchannel.cpp') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 4b0a70ffd8..a99047c163 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -67,12 +67,18 @@ void LLCommunicationChannel::clearHistory() mHistory.clear(); } +void LLCommunicationChannel::removeItem(history_list_t::const_iterator itemToRemove) +{ + mHistory.erase(itemToRemove); +} + void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr) { std::string notificationType = pNotificationPtr->getType(); if ((notificationType == "groupnotify") || (notificationType == "offer") - || (notificationType == "notifytoast")) + || (notificationType == "notifytoast") + && !pNotificationPtr->isCancelled()) { mHistory.insert(std::make_pair(pNotificationPtr->getDate(), pNotificationPtr)); } -- cgit v1.2.3 From de9e2c38126682e5c6215151e3389380a93b8bc0 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 15 Jan 2013 20:36:48 -0800 Subject: CHUI-668: Code review changes --- indra/newview/llcommunicationchannel.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcommunicationchannel.cpp') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index a99047c163..0821510645 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -52,6 +52,11 @@ bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) return !gAgent.isDoNotDisturb(); } +S32 LLCommunicationChannel::getHistorySize() const +{ + return mHistory.size(); +} + LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const { return mHistory.begin(); @@ -62,14 +67,37 @@ LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::e return mHistory.end(); } +LLCommunicationChannel::history_list_t::iterator LLCommunicationChannel::beginHistory() +{ + return mHistory.begin(); +} + +LLCommunicationChannel::history_list_t::iterator LLCommunicationChannel::endHistory() +{ + return mHistory.end(); +} + void LLCommunicationChannel::clearHistory() { mHistory.clear(); } -void LLCommunicationChannel::removeItem(history_list_t::const_iterator itemToRemove) +void LLCommunicationChannel::removeItemFromHistory(LLNotificationPtr p) +{ + //Find the notification and removes it from mHistory + for(history_list_t::iterator it = beginHistory(); it != endHistory(); ++it) + { + if(it->second == p) + { + mHistory.erase(it); + break; + } + } +} + +void LLCommunicationChannel::onDelete(LLNotificationPtr p) { - mHistory.erase(itemToRemove); + removeItemFromHistory(p); } void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr) -- cgit v1.2.3