diff options
| author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-01-17 13:52:51 -0800 | 
|---|---|---|
| committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-01-17 13:52:51 -0800 | 
| commit | fdf774f51fd24bb62d1e1fc580bd04df4547b9f8 (patch) | |
| tree | 6d773c8a77cee95bdef6641705a092b23c0368c8 /indra | |
| parent | 41a53e864924cdb192aad9b3906006d7e8d4c91e (diff) | |
CHUI-685 Problem: The notifications .xml file was cleared upon exit because removeIMNotification was being called and deleting inventory offers becaus they did not have a session id. Resolution: Now check to make sure that removeIMNotification only removes IMs (IMToast).
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/lldonotdisturbnotificationstorage.cpp | 62 | ||||
| -rw-r--r-- | indra/newview/lldonotdisturbnotificationstorage.h | 3 | ||||
| -rw-r--r-- | indra/newview/llfloaterimcontainer.cpp | 16 | 
3 files changed, 40 insertions, 41 deletions
| diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 42b455c1ce..5bea7d41f6 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -43,15 +43,16 @@  #include "lluuid.h"  static const F32 DND_TIMER = 3.0; +const std::string toastName = "IMToast";  LLDoNotDisturbNotificationStorageTimer::LLDoNotDisturbNotificationStorageTimer() : LLEventTimer(DND_TIMER)  { -    mEventTimer.start(); +    //mEventTimer.start();  }  LLDoNotDisturbNotificationStorageTimer::~LLDoNotDisturbNotificationStorageTimer()  { -    mEventTimer.stop(); +    //mEventTimer.stop();  }  BOOL LLDoNotDisturbNotificationStorageTimer::tick() @@ -152,27 +153,27 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()          std::string notificationName = notification_params["name"];          LLNotificationPtr notification = instance.find(notificationID); -        if(notificationName == "IMToast") +        if(notificationName == toastName)          {              imToastExists = true;          }          //New notification needs to be added -            notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true)); -			LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]); -			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); +        notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true)); +		LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]); +		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(imToastExists)      { @@ -200,7 +201,7 @@ void LLDoNotDisturbNotificationStorage::updateNotifications()          LLNotificationPtr notification = it->second;          std::string notificationName = notification->getName(); -        if(notificationName == "IMToast") +        if(notificationName == toastName)          {              imToastExists = true;          } @@ -221,9 +222,9 @@ void LLDoNotDisturbNotificationStorage::updateNotifications()      //When exit DND mode, write empty notifications file      if(commChannel->getHistorySize())      { -	commChannel->clearHistory(); -	saveNotifications(); -} +	    commChannel->clearHistory(); +	    saveNotifications(); +    }  }  LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const @@ -241,6 +242,7 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi      LLNotificationPtr notification;      LLSD substitutions;      LLUUID notificationSessionID; +    std::string notificationName;      LLCommunicationChannel::history_list_t::iterator it;      std::vector<LLCommunicationChannel::history_list_t::iterator> itemsToRemove; @@ -252,8 +254,10 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi          notification = it->second;          substitutions = notification->getSubstitutions();          notificationSessionID = substitutions["SESSION_ID"].asUUID(); +        notificationName = notification->getName(); -        if(session_id == notificationSessionID) +        if(notificationName == toastName +            && session_id == notificationSessionID)          {              itemsToRemove.push_back(it);          } @@ -263,14 +267,14 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi      //Remove the notifications      if(itemsToRemove.size())      { -    while(itemsToRemove.size()) -    { -        it = itemsToRemove.back(); -        notification = it->second; +        while(itemsToRemove.size()) +        { +            it = itemsToRemove.back(); +            notification = it->second;              commChannel->removeItemFromHistory(notification); -        instance.cancel(notification); -        itemsToRemove.pop_back(); -    } +            instance.cancel(notification); +            itemsToRemove.pop_back(); +        }          //Trigger saving of notifications to xml once all have been removed          saveNotifications();      } diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h index fd03b71357..fd7cc7ee82 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.h +++ b/indra/newview/lldonotdisturbnotificationstorage.h @@ -42,9 +42,6 @@ public:      ~LLDoNotDisturbNotificationStorageTimer();  public: -    void startTimer(); -    void stopTimer(); -    bool isRunning();      BOOL tick();  }; diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index cc23449449..8f290ae7c1 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1299,11 +1299,14 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool      	if (widget && widget->getParentFolder())      	{      		widget->getParentFolder()->setSelection(widget, FALSE, FALSE); -            if(gAgent.isDoNotDisturb()) -            { -                LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id); -            }      	} + +        //When in DND mode, remove stored IM notifications +        //Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal +        if(gAgent.isDoNotDisturb() && session_id.notNull()) +        { +            LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id); +        }      }      /* floater processing */ @@ -1324,11 +1327,6 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool  				// Switch to the conversation floater that is being selected  				selectFloater(session_floater);  			} - -            if(gAgent.isDoNotDisturb()) -            { -                LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id); -            }  		}  		// Set the focus on the selected floater | 
