summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2012-12-19 17:54:34 -0800
committerGilbert Gonzales <gilbert@lindenlab.com>2012-12-19 17:54:34 -0800
commit2feff5fe7495dddbaa7878d4e804ad2bea149971 (patch)
tree9549675869d4e7d0807504f294fd4a763b9bb95f
parentcc900b732dd1af2790248485a270197a4006e0f7 (diff)
parentb15ba74485e24db9a996a2f6a9438ac48224ea7a (diff)
merging in latest changes
-rwxr-xr-xindra/newview/app_settings/settings.xml2
-rwxr-xr-xindra/newview/llagent.cpp14
-rw-r--r--indra/newview/llchannelmanager.cpp2
-rw-r--r--indra/newview/llcommunicationchannel.cpp6
-rw-r--r--indra/newview/llcommunicationchannel.h2
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.cpp81
-rw-r--r--indra/newview/llnotificationstorage.cpp75
-rw-r--r--indra/newview/llnotificationstorage.h3
-rw-r--r--indra/newview/llpersistentnotificationstorage.cpp67
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml10
10 files changed, 186 insertions, 76 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 24fa0a0cd4..ebc915ec5a 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4676,7 +4676,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
- <integer>0</integer>
+ <integer>1</integer>
</map>
<key>LandBrushSize</key>
<map>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 49c570c30b..fc3be9ca21 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -41,6 +41,7 @@
#include "llchannelmanager.h"
#include "llchicletbar.h"
#include "llconsole.h"
+#include "lldonotdisturbnotificationstorage.h"
#include "llenvmanager.h"
#include "llfirstuse.h"
#include "llfloatercamera.h"
@@ -1389,11 +1390,16 @@ BOOL LLAgent::getAFK() const
//-----------------------------------------------------------------------------
// setDoNotDisturb()
//-----------------------------------------------------------------------------
-void LLAgent::setDoNotDisturb(bool pIsDotNotDisturb)
+void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb)
{
- mIsDoNotDisturb = pIsDotNotDisturb;
- sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDotNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
- LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDotNotDisturb);
+ bool isDoNotDisturbSwitchedOff = (mIsDoNotDisturb && !pIsDoNotDisturb);
+ mIsDoNotDisturb = pIsDoNotDisturb;
+ sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP));
+ LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDoNotDisturb);
+ if (isDoNotDisturbSwitchedOff)
+ {
+ LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
+ }
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp
index dd2bcc742b..43757d0174 100644
--- a/indra/newview/llchannelmanager.cpp
+++ b/indra/newview/llchannelmanager.cpp
@@ -139,7 +139,9 @@ void LLChannelManager::onLoginCompleted()
}
LLPersistentNotificationStorage::getInstance()->loadNotifications();
+
LLDoNotDisturbNotificationStorage::getInstance()->initialize();
+ LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
}
//--------------------------------------------------------------------------
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();
diff --git a/indra/newview/llcommunicationchannel.h b/indra/newview/llcommunicationchannel.h
index a4756b8993..0e15e1cd15 100644
--- a/indra/newview/llcommunicationchannel.h
+++ b/indra/newview/llcommunicationchannel.h
@@ -46,6 +46,8 @@ public:
typedef std::multimap<LLDate, LLNotificationPtr> history_list_t;
history_list_t::const_iterator beginHistory() const;
history_list_t::const_iterator endHistory() const;
+
+ void clearHistory();
protected:
virtual void onFilterFail(LLNotificationPtr pNotificationPtr);
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 472a0dd9ee..bf3dcae1f3 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -29,14 +29,25 @@
#include "lldonotdisturbnotificationstorage.h"
+#define XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT 0
+
+#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+#include "llchannelmanager.h"
+#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
#include "llcommunicationchannel.h"
#include "lldir.h"
#include "llerror.h"
#include "llfasttimer_class.h"
#include "llnotifications.h"
+#include "llnotificationhandler.h"
#include "llnotificationstorage.h"
+#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+#include "llscreenchannel.h"
+#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+#include "llscriptfloater.h"
#include "llsd.h"
#include "llsingleton.h"
+#include "lluuid.h"
LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
: LLSingleton<LLDoNotDisturbNotificationStorage>()
@@ -85,6 +96,76 @@ static LLFastTimer::DeclareTimer FTM_LOAD_DND_NOTIFICATIONS("Load DND Notificati
void LLDoNotDisturbNotificationStorage::loadNotifications()
{
+ LLFastTimer _(FTM_LOAD_DND_NOTIFICATIONS);
+
+ LLSD input;
+ if (!readNotifications(input) ||input.isUndefined())
+ {
+ return;
+ }
+
+ LLSD& data = input["data"];
+ if (data.isUndefined())
+ {
+ return;
+ }
+
+#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+ LLNotificationsUI::LLScreenChannel* notification_channel =
+ dynamic_cast<LLNotificationsUI::LLScreenChannel*>(LLNotificationsUI::LLChannelManager::getInstance()->
+ findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
+#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+
+ LLNotifications& instance = LLNotifications::instance();
+
+ for (LLSD::array_const_iterator notification_it = data.beginArray();
+ notification_it != data.endArray();
+ ++notification_it)
+ {
+ LLSD notification_params = *notification_it;
+ LLNotificationPtr notification(new LLNotification(notification_params));
+
+ const LLUUID& notificationID = notification->id();
+ if (instance.find(notificationID))
+ {
+ instance.update(notification);
+ }
+ else
+ {
+ LLNotificationResponderInterface* responder = createResponder(notification_params["name"], notification_params["responder"]);
+ if (responder == NULL)
+ {
+ LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '"
+ << notification->getType() << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLNotificationResponderPtr responderPtr(responder);
+ notification->setResponseFunctor(responderPtr);
+ }
+
+ instance.add(notification);
+ }
+
+#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+ // hide script floaters so they don't confuse the user and don't overlap startup toast
+ LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false);
+
+ if(notification_channel)
+ {
+ // hide saved toasts so they don't confuse the user
+ notification_channel->hideToast(notification->getID());
+ }
+#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT
+ }
+
+ // Clear the communication channel history and rewrite the save file to empty it as well
+ LLNotificationChannelPtr channelPtr = getCommunicationChannel();
+ LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
+ llassert(commChannel != NULL);
+ commChannel->clearHistory();
+
+ saveNotifications();
}
LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const
diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp
index d25a212059..b797775369 100644
--- a/indra/newview/llnotificationstorage.cpp
+++ b/indra/newview/llnotificationstorage.cpp
@@ -29,14 +29,39 @@
#include "llnotificationstorage.h"
#include <string>
+#include <map>
#include "llerror.h"
#include "llfile.h"
+#include "llnotifications.h"
#include "llpointer.h"
#include "llsd.h"
#include "llsdserialize.h"
+#include "llsingleton.h"
+#include "llviewermessage.h"
+class LLResponderRegistry : public LLSingleton<LLResponderRegistry>
+{
+public:
+ LLResponderRegistry();
+ ~LLResponderRegistry();
+
+ LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams);
+
+protected:
+
+private:
+ template<typename RESPONDER_TYPE> static LLNotificationResponderInterface* create(const LLSD& pParams);
+
+ typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t;
+
+ void add(const std::string& pNotificationName, const responder_constructor_t& pConstructor);
+
+ typedef std::map<std::string, responder_constructor_t> build_map_t;
+ build_map_t mBuildMap;
+};
+
LLNotificationStorage::LLNotificationStorage(std::string pFileName)
: mFileName(pFileName)
{
@@ -90,3 +115,53 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData) const
return didFileRead;
}
+
+LLNotificationResponderInterface* LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const
+{
+ return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
+}
+
+LLResponderRegistry::LLResponderRegistry()
+ : LLSingleton<LLResponderRegistry>()
+ , mBuildMap()
+{
+ add("ObjectGiveItem", &create<LLOfferInfo>);
+ add("OwnObjectGiveItem", &create<LLOfferInfo>);
+ add("UserGiveItem", &create<LLOfferInfo>);
+
+ add("TeleportOffered", &create<LLOfferInfo>);
+ add("TeleportOffered_MaturityExceeded", &create<LLOfferInfo>);
+
+ add("OfferFriendship", &create<LLOfferInfo>);
+}
+
+LLResponderRegistry::~LLResponderRegistry()
+{
+}
+
+LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& pNotificationName, const LLSD& pParams)
+{
+ build_map_t::const_iterator it = mBuildMap.find(pNotificationName);
+ if(mBuildMap.end() == it)
+ {
+ return NULL;
+ }
+ responder_constructor_t ctr = it->second;
+ return ctr(pParams);
+}
+
+template<typename RESPONDER_TYPE> LLNotificationResponderInterface* LLResponderRegistry::create(const LLSD& pParams)
+{
+ RESPONDER_TYPE* responder = new RESPONDER_TYPE();
+ responder->fromLLSD(pParams);
+ return responder;
+}
+
+void LLResponderRegistry::add(const std::string& pNotificationName, const responder_constructor_t& pConstructor)
+{
+ if (mBuildMap.find(pNotificationName) != mBuildMap.end())
+ {
+ LL_ERRS("LLResponderRegistry") << "Responder is already registered : " << pNotificationName << LL_ENDL;
+ }
+ mBuildMap.insert(std::make_pair<std::string, responder_constructor_t>(pNotificationName, pConstructor));
+}
diff --git a/indra/newview/llnotificationstorage.h b/indra/newview/llnotificationstorage.h
index ab4da4e73f..7aabf7d09e 100644
--- a/indra/newview/llnotificationstorage.h
+++ b/indra/newview/llnotificationstorage.h
@@ -31,6 +31,7 @@
#include "llerror.h"
+class LLNotificationResponderInterface;
class LLSD;
class LLNotificationStorage
@@ -44,6 +45,8 @@ protected:
bool writeNotifications(const LLSD& pNotificationData) const;
bool readNotifications(LLSD& pNotificationData) const;
+ LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
+
private:
std::string mFileName;
};
diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp
index 7aaad64fd7..224aaa2146 100644
--- a/indra/newview/llpersistentnotificationstorage.cpp
+++ b/indra/newview/llpersistentnotificationstorage.cpp
@@ -36,34 +36,6 @@
#include "llscriptfloater.h"
#include "llviewermessage.h"
-class LLResponderRegistry
-{
-public:
-
- static void registerResponders();
-
- static LLNotificationResponderInterface* createResponder(const std::string& notification_name, const LLSD& params);
-
-protected:
-
-private:
- template<typename RESPONDER_TYPE>
- static LLNotificationResponderInterface* create(const LLSD& params)
- {
- RESPONDER_TYPE* responder = new RESPONDER_TYPE();
- responder->fromLLSD(params);
- return responder;
- }
-
- typedef boost::function<LLNotificationResponderInterface* (const LLSD& params)> responder_constructor_t;
-
- static void add(const std::string& notification_name, const responder_constructor_t& ctr);
-
- typedef std::map<std::string, responder_constructor_t> build_map_t;
-
- static build_map_t sBuildMap;
-};
-
LLPersistentNotificationStorage::LLPersistentNotificationStorage()
: LLSingleton<LLPersistentNotificationStorage>()
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml"))
@@ -114,7 +86,6 @@ static LLFastTimer::DeclareTimer FTM_LOAD_NOTIFICATIONS("Load Notifications");
void LLPersistentNotificationStorage::loadNotifications()
{
LLFastTimer _(FTM_LOAD_NOTIFICATIONS);
- LLResponderRegistry::registerResponders();
LLNotifications::instance().getChannel("Persistent")->
connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
@@ -144,8 +115,7 @@ void LLPersistentNotificationStorage::loadNotifications()
LLSD notification_params = *notification_it;
LLNotificationPtr notification(new LLNotification(notification_params));
- LLNotificationResponderPtr responder(LLResponderRegistry::
- createResponder(notification_params["name"], notification_params["responder"]));
+ LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"]));
notification->setResponseFunctor(responder);
instance.add(notification);
@@ -172,39 +142,4 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay
return false;
}
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////
-
-LLResponderRegistry::build_map_t LLResponderRegistry::sBuildMap;
-
-void LLResponderRegistry::registerResponders()
-{
- sBuildMap.clear();
-
- add("ObjectGiveItem", &create<LLOfferInfo>);
- add("UserGiveItem", &create<LLOfferInfo>);
-}
-
-LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& notification_name, const LLSD& params)
-{
- build_map_t::const_iterator it = sBuildMap.find(notification_name);
- if(sBuildMap.end() == it)
- {
- return NULL;
- }
- responder_constructor_t ctr = it->second;
- return ctr(params);
-}
-
-void LLResponderRegistry::add(const std::string& notification_name, const responder_constructor_t& ctr)
-{
- if(sBuildMap.find(notification_name) != sBuildMap.end())
- {
- llwarns << "Responder is already registered : " << notification_name << llendl;
- llassert(!"Responder already registered");
- }
- sBuildMap[notification_name] = ctr;
-}
-
// EOF
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 35ce787847..05798da8e2 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6583,7 +6583,7 @@ However, this region contains content accessible to adults only.
log_to_im="true"
log_to_chat="false"
show_toast="false"
- type="offer">
+ type="notify">
Teleport offer sent to [TO_NAME]
</notification>
@@ -6636,7 +6636,7 @@ However, this region contains content accessible to adults only.
name="FriendshipOffered"
log_to_im="true"
show_toast="false"
- type="offer">
+ type="notify">
<tag>friendship</tag>
You have offered friendship to [TO_NAME]
</notification>
@@ -6666,7 +6666,7 @@ However, this region contains content accessible to adults only.
icon="notify.tga"
name="FriendshipAccepted"
log_to_im="true"
- type="offer">
+ type="notify">
<tag>friendship</tag>
&lt;nolink&gt;[NAME]&lt;/nolink&gt; accepted your friendship offer.
</notification>
@@ -6686,7 +6686,7 @@ However, this region contains content accessible to adults only.
name="FriendshipAcceptedByMe"
log_to_im="true"
show_toast="false"
- type="offer">
+ type="notify">
<tag>friendship</tag>
Friendship offer accepted.
</notification>
@@ -6696,7 +6696,7 @@ Friendship offer accepted.
name="FriendshipDeclinedByMe"
log_to_im="true"
show_toast="false"
- type="offer">
+ type="notify">
<tag>friendship</tag>
Friendship offer declined.
</notification>