From 9a1688322ab739f8838611d1b9e37d33adc07dfb Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 13 May 2021 17:51:24 +0300
Subject: SL-15195 The notification in chat history is multiplied after
 relogging

---
 indra/newview/llbrowsernotification.cpp           |  2 +-
 indra/newview/llchiclet.h                         |  1 +
 indra/newview/llimhandler.cpp                     |  2 +-
 indra/newview/llnotificationalerthandler.cpp      |  4 ++--
 indra/newview/llnotificationgrouphandler.cpp      |  2 +-
 indra/newview/llnotificationhandler.h             | 22 +++++++++++-----------
 indra/newview/llnotificationhinthandler.cpp       |  2 +-
 indra/newview/llnotificationofferhandler.cpp      |  2 +-
 indra/newview/llnotificationscripthandler.cpp     |  4 ++--
 indra/newview/llnotificationtiphandler.cpp        |  2 +-
 indra/newview/llpersistentnotificationstorage.cpp |  2 +-
 11 files changed, 23 insertions(+), 22 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp
index 0460bff1b4..7614624306 100644
--- a/indra/newview/llbrowsernotification.cpp
+++ b/indra/newview/llbrowsernotification.cpp
@@ -40,7 +40,7 @@ LLBrowserNotification::LLBrowserNotification()
 {
 }
 
-bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification)
+bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
 	LLUUID media_id = notification->getPayload()["media_id"].asUUID();
 	LLMediaCtrl* media_instance = LLMediaCtrl::getInstance(media_id);
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 9201c6bc00..aceedda07e 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -546,6 +546,7 @@ protected:
 		static bool filterNotification(LLNotificationPtr notify);
 		// connect counter updaters to the corresponding signals
 		/*virtual*/ void onAdd(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); }
+		/*virtual*/ void onLoad(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); }
 		/*virtual*/ void onDelete(LLNotificationPtr p) { mChiclet->setCounter(--mChiclet->mUreadSystemNotifications); }
 				
 		LLNotificationChiclet* const mChiclet;
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index c2b29f36e8..0fa3dc1110 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -60,7 +60,7 @@ void LLIMHandler::initChannel()
 }
 
 //--------------------------------------------------------------------------
-bool LLIMHandler::processNotification(const LLNotificationPtr& notification)
+bool LLIMHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
     if(notification->isDND())
     {
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index 58a9b01a45..90b9cdc133 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -69,7 +69,7 @@ void LLAlertHandler::initChannel()
 }
 
 //--------------------------------------------------------------------------
-bool LLAlertHandler::processNotification(const LLNotificationPtr& notification)
+bool LLAlertHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
 	if(mChannel.isDead())
 	{
@@ -131,7 +131,7 @@ LLViewerAlertHandler::LLViewerAlertHandler(const std::string& name, const std::s
 {
 }
 
-bool LLViewerAlertHandler::processNotification(const LLNotificationPtr& p)
+bool LLViewerAlertHandler::processNotification(const LLNotificationPtr& p, bool should_log)
 {
 	if (gHeadlessClient)
 	{
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index 8fef102cf8..f87ebf219b 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -62,7 +62,7 @@ void LLGroupHandler::initChannel()
 }
 
 //--------------------------------------------------------------------------
-bool LLGroupHandler::processNotification(const LLNotificationPtr& notification)
+bool LLGroupHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
 	if(mChannel.isDead())
 	{
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index ef4aced2c7..ddc957c941 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -96,10 +96,10 @@ public:
 	// base interface functions
 	virtual void onAdd(LLNotificationPtr p) { processNotification(p); }
 	virtual void onChange(LLNotificationPtr p) { processNotification(p); }
-	virtual void onLoad(LLNotificationPtr p) { processNotification(p); }
+	virtual void onLoad(LLNotificationPtr p) { processNotification(p, false); }
 	virtual void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());}
 
-	virtual bool processNotification(const LLNotificationPtr& notify) = 0;
+	virtual bool processNotification(const LLNotificationPtr& notify, bool should_log = true) = 0;
 };
 
 class LLSystemNotificationHandler : public LLNotificationHandler
@@ -136,7 +136,7 @@ class LLIMHandler : public LLCommunicationNotificationHandler
 public:
 	LLIMHandler();
 	virtual ~LLIMHandler();
-	bool processNotification(const LLNotificationPtr& p);
+	bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel();
@@ -152,7 +152,7 @@ public:
 	LLTipHandler();
 	virtual ~LLTipHandler();
 
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel();
@@ -170,7 +170,7 @@ public:
 
 	virtual void onDelete(LLNotificationPtr p);
 	virtual void onChange(LLNotificationPtr p);
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 	virtual void addToastWithNotification(const LLNotificationPtr& p);
 
 protected:
@@ -188,7 +188,7 @@ public:
 	LLGroupHandler();
 	virtual ~LLGroupHandler();
 	
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel();
@@ -204,7 +204,7 @@ public:
 	virtual ~LLAlertHandler();
 
 	virtual void onChange(LLNotificationPtr p);
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel();
@@ -220,7 +220,7 @@ public:
 	virtual ~LLViewerAlertHandler() {};
 
 	virtual void onDelete(LLNotificationPtr p) {};
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel() {};
@@ -238,7 +238,7 @@ public:
 
 	virtual void onChange(LLNotificationPtr p);
 	virtual void onDelete(LLNotificationPtr notification);
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel();
@@ -256,7 +256,7 @@ public:
 	virtual void onAdd(LLNotificationPtr p);
 	virtual void onLoad(LLNotificationPtr p);
 	virtual void onDelete(LLNotificationPtr p);
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel() {};
@@ -271,7 +271,7 @@ public:
 	LLBrowserNotification();
 	virtual ~LLBrowserNotification() {}
 
-	virtual bool processNotification(const LLNotificationPtr& p);
+	virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
 
 protected:
 	virtual void initChannel() {};
diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp
index f1226c53ff..44ebc5ed47 100644
--- a/indra/newview/llnotificationhinthandler.cpp
+++ b/indra/newview/llnotificationhinthandler.cpp
@@ -53,7 +53,7 @@ void LLHintHandler::onDelete(LLNotificationPtr p)
 	LLHints::getInstance()->hide(p);
 }
 
-bool LLHintHandler::processNotification(const LLNotificationPtr& p)
+bool LLHintHandler::processNotification(const LLNotificationPtr& p, bool should_log)
 {
 	return false;
 }
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index a9678b1e93..201eaeb9f8 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -68,7 +68,7 @@ void LLOfferHandler::initChannel()
 }
 
 //--------------------------------------------------------------------------
-bool LLOfferHandler::processNotification(const LLNotificationPtr& notification)
+bool LLOfferHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
 	if(mChannel.isDead())
 	{
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index ba831ab2ed..43c3ee3ce2 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -92,7 +92,7 @@ void LLScriptHandler::addToastWithNotification(const LLNotificationPtr& notifica
 }
 
 //--------------------------------------------------------------------------
-bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
+bool LLScriptHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
 	if(mChannel.isDead())
 	{
@@ -105,7 +105,7 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
 		initChannel();
 	}
 	
-	if (notification->canLogToIM())
+	if (should_log && notification->canLogToIM())
 	{
 		LLHandlerUtil::logToIMP2P(notification);
 	}
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index a6ef130cd0..91f93067de 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -66,7 +66,7 @@ void LLTipHandler::initChannel()
 }
 
 //--------------------------------------------------------------------------
-bool LLTipHandler::processNotification(const LLNotificationPtr& notification)
+bool LLTipHandler::processNotification(const LLNotificationPtr& notification, bool should_log)
 {
 	if(mChannel.isDead())
 	{
diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp
index f95ab9928d..18888f2723 100644
--- a/indra/newview/llpersistentnotificationstorage.cpp
+++ b/indra/newview/llpersistentnotificationstorage.cpp
@@ -150,7 +150,7 @@ void LLPersistentNotificationStorage::loadNotifications()
 		LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"]));
 		notification->setResponseFunctor(responder);
 
-		instance.add(notification);
+		instance.load(notification);
 
 		// hide script floaters so they don't confuse the user and don't overlap startup toast
 		LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false);
-- 
cgit v1.2.3