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.
meow-7.2.2
Monroe Linden 2010-09-30 14:48:36 -07:00
parent bd9ad4369a
commit 2b6d3b851f
4 changed files with 70 additions and 1 deletions

View File

@ -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.

View File

@ -580,6 +580,8 @@ public:
std::string summarize() const;
bool hasUniquenessConstraints() const;
bool matchesTag(const std::string& tag);
virtual ~LLNotification() {}
};

View File

@ -156,6 +156,15 @@ struct LLNotificationTemplate
{}
};
struct Tag : public LLInitParam::Block<Tag>
{
Mandatory<std::string> value;
Tag()
: value("value")
{}
};
struct Params : public LLInitParam::Block<Params>
{
Mandatory<std::string> name;
@ -173,6 +182,7 @@ struct LLNotificationTemplate
Optional<FormRef> form_ref;
Optional<ENotificationPriority,
NotificationPriorityValues> priority;
Multiple<Tag> 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<std::string> mTags;
};
#endif //LL_LLNOTIFICATION_TEMPLATE_H

View File

@ -5046,6 +5046,7 @@ You can only claim public land in the Region you&apos;re in.
name="RegionTPAccessBlocked"
persist="true"
type="notify">
<tag>fail</tag>
You aren&apos;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">
<tag>fail</tag>
You are banned from the region.
</notification>
@ -5064,6 +5066,7 @@ You are banned from the region.
name="NoTeenGridAccess"
persist="true"
type="notify">
<tag>fail</tag>
Your account cannot connect to this teen grid region.
</notification>
@ -5072,6 +5075,7 @@ Your account cannot connect to this teen grid region.
name="ImproperPaymentStatus"
persist="true"
type="notify">
<tag>fail</tag>
You do not have proper payment status to enter this region.
</notification>
@ -5080,6 +5084,7 @@ You do not have proper payment status to enter this region.
name="MustGetAgeRgion"
persist="true"
type="notify">
<tag>fail</tag>
You must be age-verified to enter this region.
</notification>
@ -5088,6 +5093,7 @@ You must be age-verified to enter this region.
name="MustGetAgeParcel"
persist="true"
type="notify">
<tag>fail</tag>
You must be age-verified to enter this parcel.
</notification>
@ -5096,6 +5102,7 @@ You must be age-verified to enter this parcel.
name="NoDestRegion"
persist="true"
type="notify">
<tag>fail</tag>
No destination region found.
</notification>
@ -5104,6 +5111,7 @@ No destination region found.
name="NotAllowedInDest"
persist="true"
type="notify">
<tag>fail</tag>
You are not allowed into the destination.
</notification>
@ -5112,6 +5120,7 @@ You are not allowed into the destination.
name="RegionParcelBan"
persist="true"
type="notify">
<tag>fail</tag>
Cannot region cross into banned parcel. Try another way.
</notification>
@ -5128,6 +5137,7 @@ You have been redirected to a telehub.
name="CouldntTPCloser"
persist="true"
type="notify">
<tag>fail</tag>
Could not teleport closer to destination.
</notification>
@ -5144,6 +5154,7 @@ Teleport cancelled.
name="FullRegionTryAgain"
persist="true"
type="notify">
<tag>fail</tag>
The region you are attempting to enter is currently full.
Please try again in a few moments.
</notification>
@ -5153,6 +5164,7 @@ Please try again in a few moments.
name="GeneralFailure"
persist="true"
type="notify">
<tag>fail</tag>
General failure.
</notification>
@ -5161,6 +5173,7 @@ General failure.
name="RoutedWrongRegion"
persist="true"
type="notify">
<tag>fail</tag>
Routed to wrong region. Please try again.
</notification>
@ -5169,6 +5182,7 @@ Routed to wrong region. Please try again.
name="NoValidAgentID"
persist="true"
type="notify">
<tag>fail</tag>
No valid agent id.
</notification>
@ -5177,6 +5191,7 @@ No valid agent id.
name="NoValidSession"
persist="true"
type="notify">
<tag>fail</tag>
No valid session id.
</notification>
@ -5185,6 +5200,7 @@ No valid session id.
name="NoValidCircuit"
persist="true"
type="notify">
<tag>fail</tag>
No valid circuit code.
</notification>
@ -5193,6 +5209,7 @@ No valid circuit code.
name="NoValidTimestamp"
persist="true"
type="notify">
<tag>fail</tag>
No valid timestamp.
</notification>
@ -5201,6 +5218,7 @@ No valid timestamp.
name="NoPendingConnection"
persist="true"
type="notify">
<tag>fail</tag>
Unable to create pending connection.
</notification>
@ -5209,6 +5227,7 @@ Unable to create pending connection.
name="InternalUsherError"
persist="true"
type="notify">
<tag>fail</tag>
Internal error attempting to connect agent usher.
</notification>
@ -5217,6 +5236,7 @@ Internal error attempting to connect agent usher.
name="NoGoodTPDestination"
persist="true"
type="notify">
<tag>fail</tag>
Unable to find a good teleport destination in this region.
</notification>
@ -5225,6 +5245,7 @@ Unable to find a good teleport destination in this region.
name="InternalErrorRegionResolver"
persist="true"
type="notify">
<tag>fail</tag>
Internal error attempting to activate region resolver.
</notification>
@ -5233,6 +5254,7 @@ Internal error attempting to activate region resolver.
name="NoValidLanding"
persist="true"
type="notify">
<tag>fail</tag>
A valid landing point could not be found.
</notification>
@ -5241,6 +5263,7 @@ A valid landing point could not be found.
name="NoValidParcel"
persist="true"
type="notify">
<tag>fail</tag>
No valid parcel could be found.
</notification>