From d0204ab367f5ceb5eab89e2273b897975acbfe5a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 23 Jan 2013 09:51:17 -0800 Subject: CHUI-687: Problem: User sees inventory offer notifications for deleted items when logging in from do not disturb mode. Resolution: If an item that is deletes has a DND notification saved, then remove that notification so that it doesn't appear onec the user exists DND mode. --- .../newview/lldonotdisturbnotificationstorage.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/newview/lldonotdisturbnotificationstorage.cpp') diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 824ff67972..abceb5c10d 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -43,7 +43,8 @@ #include "lluuid.h" static const F32 DND_TIMER = 3.0; -const std::string toastName = "IMToast"; +const char * LLDoNotDisturbNotificationStorage::toastName = "IMToast"; +const char * LLDoNotDisturbNotificationStorage::offerName = "UserGiveItem"; LLDoNotDisturbNotificationStorageTimer::LLDoNotDisturbNotificationStorageTimer() : LLEventTimer(DND_TIMER) { @@ -72,6 +73,8 @@ LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage() , LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "dnd_notifications.xml")) , mDirty(false) { + nameToPayloadParameterMap[toastName] = "SESSION_ID"; + nameToPayloadParameterMap[offerName] = "object_id"; } LLDoNotDisturbNotificationStorage::~LLDoNotDisturbNotificationStorage() @@ -234,15 +237,16 @@ LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChan return channelPtr; } -void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& session_id) +void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, const LLUUID& id) { LLNotifications& instance = LLNotifications::instance(); LLNotificationChannelPtr channelPtr = getCommunicationChannel(); LLCommunicationChannel *commChannel = dynamic_cast(channelPtr.get()); LLNotificationPtr notification; - LLSD substitutions; - LLUUID notificationSessionID; + LLSD payload; + LLUUID notificationObjectID; std::string notificationName; + std::string payloadVariable = nameToPayloadParameterMap[name]; LLCommunicationChannel::history_list_t::iterator it; std::vector itemsToRemove; @@ -252,18 +256,18 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi ++it) { notification = it->second; - substitutions = notification->getSubstitutions(); - notificationSessionID = substitutions["SESSION_ID"].asUUID(); + payload = notification->getPayload(); + notificationObjectID = payload[payloadVariable].asUUID(); notificationName = notification->getName(); - if(notificationName == toastName - && session_id == notificationSessionID) + if(notificationName == name + && id == notificationObjectID) { itemsToRemove.push_back(it); } } - + //Remove the notifications if(itemsToRemove.size()) { -- cgit v1.2.3 From 0911dafd81b8360235eb6f6b85fac7153a5d4a02 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 23 Jan 2013 11:39:33 -0800 Subject: CHUI-687: post code review changes. Now upon deletion of an item, DND mode must be enabled in order to remove a notification from the DND history. --- indra/newview/lldonotdisturbnotificationstorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldonotdisturbnotificationstorage.cpp') diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index abceb5c10d..15c42e8285 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -260,7 +260,7 @@ void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, co notificationObjectID = payload[payloadVariable].asUUID(); notificationName = notification->getName(); - if(notificationName == name + if((notificationName == name) && id == notificationObjectID) { itemsToRemove.push_back(it); -- cgit v1.2.3