summaryrefslogtreecommitdiff
path: root/indra/llui/llnotifications.cpp
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-09-30 14:48:36 -0700
committerMonroe Linden <monroe@lindenlab.com>2010-09-30 14:48:36 -0700
commit2b6d3b851fc6210e7cf6272ac0bc9f8645ca5644 (patch)
tree89d50185f11f331ddf9ccdb0f100281e9ab6bdf8 /indra/llui/llnotifications.cpp
parentbd9ad4369ad93099e2e87bb92b31daf90da01e4c (diff)
Adding tags mechanism to notification visibility rules.
Also started adding the tag 'fail' to entries in notifications.xml that are failures the user should always be told about. Reviewed by Richard.
Diffstat (limited to 'indra/llui/llnotifications.cpp')
-rw-r--r--indra/llui/llnotifications.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index dd56f03237..289020fa3f 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -437,6 +437,14 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par
mUniqueContext.push_back(it->key);
}
+ for(LLInitParam::ParamIterator<LLNotificationTemplate::Tag>::const_iterator it = p.tags.begin(),
+ end_it = p.tags.end();
+ it != end_it;
+ ++it)
+ {
+ mTags.push_back(it->value);
+ }
+
mForm = LLNotificationFormPtr(new LLNotificationForm(p.name, p.form_ref.form));
}
@@ -716,6 +724,25 @@ bool LLNotification::hasUniquenessConstraints() const
return (mTemplatep ? mTemplatep->mUnique : false);
}
+bool LLNotification::matchesTag(const std::string& tag)
+{
+ bool result = false;
+
+ if(mTemplatep)
+ {
+ std::list<std::string>::iterator it;
+ for(it = mTemplatep->mTags.begin(); it != mTemplatep->mTags.end(); it++)
+ {
+ if((*it) == tag)
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+
+ return result;
+}
void LLNotification::setIgnored(bool ignore)
{
@@ -1653,7 +1680,12 @@ bool LLNotifications::isVisibleByRules(LLNotificationPtr n)
if(!(*it)->mTag.empty())
{
- // TODO: check this notification's tag(s) against it->mTag and continue if no match is found.
+ // check this notification's tag(s) against it->mTag and continue if no match is found.
+ if(!n->matchesTag((*it)->mTag))
+ {
+ // This rule's non-empty tag didn't match one of the notification's tags. Skip this rule.
+ continue;
+ }
}
// If we got here, the rule matches. Don't evaluate subsequent rules.