Skip to content
Snippets Groups Projects
Commit 9a168832 authored by Mnikolenko Productengine's avatar Mnikolenko Productengine
Browse files

SL-15195 The notification in chat history is multiplied after relogging

parent fde4bd2c
No related branches found
No related tags found
No related merge requests found
Showing with 43 additions and 22 deletions
......@@ -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;
......
......@@ -910,6 +910,7 @@ class LLNotifications :
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 @@ class LLPersistentNotificationChannel : public LLNotificationChannel
mHistory.push_back(p);
}
void onLoad(LLNotificationPtr p)
{
mHistory.push_back(p);
}
std::vector<LLNotificationPtr> mHistory;
};
......
......@@ -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);
......
......@@ -546,6 +546,7 @@ class LLNotificationChiclet : public LLSysWellChiclet
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;
......
......@@ -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())
{
......
......@@ -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)
{
......
......@@ -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())
{
......
......@@ -96,10 +96,10 @@ class LLNotificationHandler : public LLEventHandler, public LLNotificationChanne
// 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 @@ class LLTipHandler : public LLSystemNotificationHandler
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 @@ class LLScriptHandler : public LLSystemNotificationHandler
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 @@ class LLGroupHandler : public LLCommunicationNotificationHandler
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 @@ class LLAlertHandler : public LLSystemNotificationHandler
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 @@ class LLViewerAlertHandler : public LLSystemNotificationHandler
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 @@ class LLOfferHandler : public LLCommunicationNotificationHandler
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 @@ class LLHintHandler : public LLSystemNotificationHandler
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 @@ class LLBrowserNotification : public LLSystemNotificationHandler
LLBrowserNotification();
virtual ~LLBrowserNotification() {}
virtual bool processNotification(const LLNotificationPtr& p);
virtual bool processNotification(const LLNotificationPtr& p, bool should_log = true);
protected:
virtual void initChannel() {};
......
......@@ -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;
}
......@@ -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())
{
......
......@@ -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);
}
......
......@@ -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())
{
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment