diff options
author | Cho <cho@lindenlab.com> | 2014-05-17 04:21:56 +0100 |
---|---|---|
committer | Cho <cho@lindenlab.com> | 2014-05-17 04:21:56 +0100 |
commit | 43d12faffebe327b32724abbb5612e0351a18976 (patch) | |
tree | 9dc284c6dc6a5c518edb64c032b59c018ee307e7 /indra/llui | |
parent | 9a7458f9e32773c07b689a6d490e5bfe9c6ec47f (diff) |
Added COMBINE_WITH_NEW for notifications for ACME-1471
Diffstat (limited to 'indra/llui')
-rwxr-xr-x | indra/llui/llnotifications.cpp | 32 | ||||
-rwxr-xr-x | indra/llui/llnotifications.h | 4 | ||||
-rwxr-xr-x | indra/llui/llnotificationtemplate.h | 1 |
3 files changed, 36 insertions, 1 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 025cd81d92..f4ad4a12db 100755 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -678,7 +678,7 @@ void LLNotification::respond(const LLSD& response) // and then call it functor(asLLSD(), response); } - else + else if (mCombinedNotifications.empty()) { // no registered responder return; @@ -700,6 +700,14 @@ void LLNotification::respond(const LLSD& response) } } + for (std::vector<LLNotificationPtr>::const_iterator it = mCombinedNotifications.begin(); it != mCombinedNotifications.end(); ++it) + { + if ((*it)) + { + (*it)->respond(response); + } + } + update(); } @@ -1321,6 +1329,28 @@ bool LLNotifications::failedUniquenessTest(const LLSD& payload) } } break; + case LLNotification::COMBINE_WITH_NEW: + // Add to the existing unique notification with the data from this particular instance... + // This guarantees that duplicate notifications will be collapsed to the one + // most recently triggered + for (LLNotificationMap::iterator existing_it = mUniqueNotifications.find(pNotif->getName()); + existing_it != mUniqueNotifications.end(); + ++existing_it) + { + LLNotificationPtr existing_notification = existing_it->second; + if (pNotif != existing_notification + && pNotif->isEquivalentTo(existing_notification)) + { + // copy the notifications from the newest instance into the oldest + existing_notification->mCombinedNotifications.push_back(pNotif); + existing_notification->mCombinedNotifications.insert(existing_notification->mCombinedNotifications.end(), + pNotif->mCombinedNotifications.begin(), pNotif->mCombinedNotifications.end()); + + // pop up again + existing_notification->update(); + } + } + break; case LLNotification::KEEP_OLD: break; case LLNotification::CANCEL_OLD: diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index b0e8553a49..0bd7e934ea 100755 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -413,6 +413,9 @@ private: using the same mechanism. */ bool mTemporaryResponder; + + // keep track of other notifications combined with COMBINE_WITH_NEW + std::vector<LLNotificationPtr> mCombinedNotifications; void init(const std::string& template_name, const LLSD& form_elements); @@ -559,6 +562,7 @@ public: typedef enum e_combine_behavior { REPLACE_WITH_NEW, + COMBINE_WITH_NEW, KEEP_OLD, CANCEL_OLD diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 0315ddbea8..c23fc53763 100755 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -43,6 +43,7 @@ struct LLNotificationTemplate static void declareValues() { declare("replace_with_new", LLNotification::REPLACE_WITH_NEW); + declare("combine_with_new", LLNotification::COMBINE_WITH_NEW); declare("keep_old", LLNotification::KEEP_OLD); declare("cancel_old", LLNotification::CANCEL_OLD); } |