From 2b6d3b851fc6210e7cf6272ac0bc9f8645ca5644 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 30 Sep 2010 14:48:36 -0700 Subject: 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. --- indra/llui/llnotifications.cpp | 34 +++++++++++++++++++++- indra/llui/llnotifications.h | 2 ++ indra/llui/llnotificationtemplate.h | 12 ++++++++ .../newview/skins/default/xui/en/notifications.xml | 23 +++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) (limited to 'indra') 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::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::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. diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 75c67151ca..98ff035170 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -580,6 +580,8 @@ public: std::string summarize() const; bool hasUniquenessConstraints() const; + + bool matchesTag(const std::string& tag); virtual ~LLNotification() {} }; diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 6bc0d2aaff..dfc2b10eb5 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -156,6 +156,15 @@ struct LLNotificationTemplate {} }; + struct Tag : public LLInitParam::Block + { + Mandatory value; + + Tag() + : value("value") + {} + }; + struct Params : public LLInitParam::Block { Mandatory name; @@ -173,6 +182,7 @@ struct LLNotificationTemplate Optional form_ref; Optional priority; + Multiple tags; Params() @@ -276,6 +286,8 @@ struct LLNotificationTemplate // this is loaded as a name, but looked up to get the UUID upon template load. // If null, it wasn't specified. LLUUID mSoundEffect; + // List of tags that rules can match against. + std::list mTags; }; #endif //LL_LLNOTIFICATION_TEMPLATE_H diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 5966db9d51..e36109caed 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5046,6 +5046,7 @@ You can only claim public land in the Region you're in. name="RegionTPAccessBlocked" persist="true" type="notify"> + fail You aren't allowed in that Region due to your maturity Rating. You may need to validate your age and/or install the latest Viewer. Please go to the Knowledge Base for details on accessing areas with this maturity Rating. @@ -5056,6 +5057,7 @@ Please go to the Knowledge Base for details on accessing areas with this maturit name="URBannedFromRegion" persist="true" type="notify"> + fail You are banned from the region. @@ -5064,6 +5066,7 @@ You are banned from the region. name="NoTeenGridAccess" persist="true" type="notify"> + fail Your account cannot connect to this teen grid region. @@ -5072,6 +5075,7 @@ Your account cannot connect to this teen grid region. name="ImproperPaymentStatus" persist="true" type="notify"> + fail You do not have proper payment status to enter this region. @@ -5080,6 +5084,7 @@ You do not have proper payment status to enter this region. name="MustGetAgeRgion" persist="true" type="notify"> + fail You must be age-verified to enter this region. @@ -5088,6 +5093,7 @@ You must be age-verified to enter this region. name="MustGetAgeParcel" persist="true" type="notify"> + fail You must be age-verified to enter this parcel. @@ -5096,6 +5102,7 @@ You must be age-verified to enter this parcel. name="NoDestRegion" persist="true" type="notify"> + fail No destination region found. @@ -5104,6 +5111,7 @@ No destination region found. name="NotAllowedInDest" persist="true" type="notify"> + fail You are not allowed into the destination. @@ -5112,6 +5120,7 @@ You are not allowed into the destination. name="RegionParcelBan" persist="true" type="notify"> + fail Cannot region cross into banned parcel. Try another way. @@ -5128,6 +5137,7 @@ You have been redirected to a telehub. name="CouldntTPCloser" persist="true" type="notify"> + fail Could not teleport closer to destination. @@ -5144,6 +5154,7 @@ Teleport cancelled. name="FullRegionTryAgain" persist="true" type="notify"> + fail The region you are attempting to enter is currently full. Please try again in a few moments. @@ -5153,6 +5164,7 @@ Please try again in a few moments. name="GeneralFailure" persist="true" type="notify"> + fail General failure. @@ -5161,6 +5173,7 @@ General failure. name="RoutedWrongRegion" persist="true" type="notify"> + fail Routed to wrong region. Please try again. @@ -5169,6 +5182,7 @@ Routed to wrong region. Please try again. name="NoValidAgentID" persist="true" type="notify"> + fail No valid agent id. @@ -5177,6 +5191,7 @@ No valid agent id. name="NoValidSession" persist="true" type="notify"> + fail No valid session id. @@ -5185,6 +5200,7 @@ No valid session id. name="NoValidCircuit" persist="true" type="notify"> + fail No valid circuit code. @@ -5193,6 +5209,7 @@ No valid circuit code. name="NoValidTimestamp" persist="true" type="notify"> + fail No valid timestamp. @@ -5201,6 +5218,7 @@ No valid timestamp. name="NoPendingConnection" persist="true" type="notify"> + fail Unable to create pending connection. @@ -5209,6 +5227,7 @@ Unable to create pending connection. name="InternalUsherError" persist="true" type="notify"> + fail Internal error attempting to connect agent usher. @@ -5217,6 +5236,7 @@ Internal error attempting to connect agent usher. name="NoGoodTPDestination" persist="true" type="notify"> + fail Unable to find a good teleport destination in this region. @@ -5225,6 +5245,7 @@ Unable to find a good teleport destination in this region. name="InternalErrorRegionResolver" persist="true" type="notify"> + fail Internal error attempting to activate region resolver. @@ -5233,6 +5254,7 @@ Internal error attempting to activate region resolver. name="NoValidLanding" persist="true" type="notify"> + fail A valid landing point could not be found. @@ -5241,6 +5263,7 @@ A valid landing point could not be found. name="NoValidParcel" persist="true" type="notify"> + fail No valid parcel could be found. -- cgit v1.2.3