diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-05-13 17:51:24 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2021-05-13 17:51:24 +0300 |
commit | 9a1688322ab739f8838611d1b9e37d33adc07dfb (patch) | |
tree | b8db75d626804619751d4e9d5e5b1f8c90298a99 | |
parent | fde4bd2cbc62fef1d3290aa86cbef615ad097bf6 (diff) |
SL-15195 The notification in chat history is multiplied after relogging
-rw-r--r-- | indra/llui/llnotifications.cpp | 14 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 6 | ||||
-rw-r--r-- | indra/newview/llbrowsernotification.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llchiclet.h | 1 | ||||
-rw-r--r-- | indra/newview/llimhandler.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationalerthandler.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llnotificationgrouphandler.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationhandler.h | 22 | ||||
-rw-r--r-- | indra/newview/llnotificationhinthandler.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationofferhandler.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationscripthandler.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llnotificationtiphandler.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpersistentnotificationstorage.cpp | 2 |
13 files changed, 43 insertions, 22 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 06ec648178..c9e5c6653b 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1699,6 +1699,20 @@ void LLNotifications::add(const LLNotificationPtr pNotif) updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif); } +void LLNotifications::load(const LLNotificationPtr pNotif) +{ + if (pNotif == NULL) return; + + // first see if we already have it -- if so, that's a problem + LLNotificationSet::iterator it=mItems.find(pNotif); + if (it != mItems.end()) + { + LL_ERRS() << "Notification loaded a second time to the master notification channel." << LL_ENDL; + } + + updateItem(LLSD().with("sigtype", "load").with("id", pNotif->id()), pNotif); +} + void LLNotifications::cancel(LLNotificationPtr pNotif) { if (pNotif == NULL || pNotif->isCancelled()) return; diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 2f4578da17..3ee48d1401 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -910,6 +910,7 @@ public: LLNotificationPtr add(const LLNotification::Params& p); void add(const LLNotificationPtr pNotif); + void load(const LLNotificationPtr pNotif); void cancel(LLNotificationPtr pNotif); void cancelByName(const std::string& name); void cancelByOwner(const LLUUID ownerId); @@ -1106,6 +1107,11 @@ private: mHistory.push_back(p); } + void onLoad(LLNotificationPtr p) + { + mHistory.push_back(p); + } + std::vector<LLNotificationPtr> mHistory; }; 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); |