summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2010-09-16 00:39:21 -0700
committerRichard Linden <none@none>2010-09-16 00:39:21 -0700
commitf87a49991a0a96c8cf11cbc9461711794aae3a72 (patch)
treed009336d19bd95204d9b3f87b88d3bb71286dbc3 /indra
parente0548d4c6f66b8236b1026f840fea37367325d95 (diff)
refactored notification template into own header file
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llnotifications.cpp302
-rw-r--r--indra/llui/llnotifications.h205
-rw-r--r--indra/llui/llnotificationtemplate.h274
3 files changed, 432 insertions, 349 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index cf93243eeb..bdc094bf47 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -27,6 +27,7 @@
#include "linden_common.h"
#include "llnotifications.h"
+#include "llnotificationtemplate.h"
#include "llinstantmessage.h"
#include "llxmlnode.h"
@@ -55,233 +56,6 @@ void NotificationPriorityValues::declareValues()
}
-namespace LLNotificationTemplateParams
-{
- using namespace LLInitParam;
-
- struct GlobalString : public Block<GlobalString>
- {
- Mandatory<std::string> name,
- value;
-
- GlobalString()
- : name("name"),
- value("value")
- {}
- };
-
- struct UniquenessContext : public Block<UniquenessContext>
- {
- Mandatory<std::string> key;
-
- UniquenessContext()
- : key("key")
- {}
-
- };
-
- struct UniquenessConstraint : public Block<UniquenessConstraint>
- {
- Multiple<UniquenessContext> contexts;
-
- UniquenessConstraint()
- : contexts("context")
- {}
- };
-
- struct FormElementBase : public Block<FormElementBase>
- {
- Mandatory<std::string> name;
-
- FormElementBase()
- : name("name")
- {}
- };
-
- struct FormIgnore : public Block<FormIgnore, FormElementBase>
- {
- Optional<std::string> text;
- Optional<bool> save_option;
-
- FormIgnore()
- : text("text"),
- save_option("save_option", false)
- {}
- };
-
- struct FormButton : public Block<FormButton, FormElementBase>
- {
- Mandatory<S32> index;
- Mandatory<std::string> text;
- Optional<std::string> ignore;
- Optional<bool> is_default;
-
- Mandatory<std::string> type;
-
- FormButton()
- : index("index"),
- text("text"),
- ignore("ignore"),
- is_default("default"),
- type("type")
- {
- // set type here so it gets serialized
- type = "button";
- }
- };
-
- struct FormInput : public Block<FormInput, FormElementBase>
- {
- Mandatory<std::string> type;
- Optional<S32> width;
-
- FormInput()
- : type("type"),
- width("width", 0)
- {}
- };
-
- struct FormElement : public Choice<FormElement>
- {
- Alternative<FormButton> button;
- Alternative<FormInput> input;
-
- FormElement()
- : button("button"),
- input("input")
- {}
- };
-
- struct FormElements : public Block<FormElements>
- {
- Multiple<FormElement> elements;
- FormElements()
- : elements("")
- {}
- };
-
- struct Form : public Block<Form>
- {
- Optional<std::string> name;
- Optional<FormIgnore> ignore;
- Optional<FormElements> form_elements;
-
- Form()
- : name("form"),
- ignore("ignore"),
- form_elements("")
- {}
- };
-
- // Templates are used to define common form types, such as OK/Cancel dialogs, etc.
-
- struct Template : public Block<Template>
- {
- Mandatory<std::string> name;
- Mandatory<Form> form;
-
- Template()
- : name("name"),
- form("form")
- {}
- };
-
- // Reference a template to use its form elements
- struct TemplateRef : public Block<TemplateRef>
- {
- Mandatory<std::string> name;
- Optional<std::string> yes_text,
- no_text,
- cancel_text,
- ignore_text;
-
- TemplateRef()
- : name("name"),
- yes_text("yestext"),
- no_text("notext"),
- cancel_text("canceltext"),
- ignore_text("ignoretext")
- {}
- };
-
- struct URL : public Block<URL>
- {
- Mandatory<S32> option;
- Mandatory<std::string> value;
- Optional<std::string> target;
- Ignored name;
-
- URL()
- : option("option", -1),
- value("value"),
- target("target", "_blank"),
- name("name")
- {}
- };
-
- struct FormRef : public Choice<FormRef>
- {
- Alternative<Form> form;
- Alternative<TemplateRef> form_template;
-
- FormRef()
- : form("form"),
- form_template("usetemplate")
- {}
- };
-
- struct Notification : public Block<Notification>
- {
- Mandatory<std::string> name;
- Optional<bool> persist;
- Optional<std::string> functor,
- icon,
- label,
- sound,
- type,
- value;
- Optional<U32> duration;
- Optional<S32> expire_option;
- Optional<URL> url;
- Optional<UniquenessConstraint> unique;
- Optional<FormRef> form_ref;
- Optional<ENotificationPriority,
- NotificationPriorityValues> priority;
-
-
- Notification()
- : name("name"),
- persist("persist", false),
- functor("functor"),
- icon("icon"),
- label("label"),
- priority("priority"),
- sound("sound"),
- type("type"),
- value("value"),
- duration("duration"),
- expire_option("expireOption", -1),
- url("url"),
- unique("unique"),
- form_ref("")
- {}
-
- };
-
- struct Notifications : public Block<Notifications>
- {
- Multiple<GlobalString> strings;
- Multiple<Template> templates;
- Multiple<Notification> notifications;
-
- Notifications()
- : strings("global"),
- notifications("notification"),
- templates("template")
- {}
- };
-}
-
// Local channel for persistent notifications
// Stores only persistent notifications.
// Class users can use connectChanged() to process persistent notifications
@@ -378,7 +152,7 @@ LLNotificationForm::LLNotificationForm()
}
-LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotificationTemplateParams::Form& p)
+LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotificationForm::Params& p)
: mIgnore(IGNORE_NO)
{
if (p.ignore.isProvided())
@@ -403,6 +177,15 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica
LLParamSDParser parser;
parser.writeSD(mFormData, p.form_elements);
+ mFormData = mFormData[""];
+ if (!mFormData.isArray())
+ {
+ // change existing contents to a one element array
+ LLSD new_llsd_array = LLSD::emptyArray();
+ new_llsd_array.append(mFormData);
+ mFormData = new_llsd_array;
+ }
+
for (LLSD::array_iterator it = mFormData.beginArray(), end_it = mFormData.endArray();
it != end_it;
++it)
@@ -413,7 +196,9 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica
*it = it->beginMap()->second;
}
}
- //llinfos << ll_pretty_print_sd(mFormData) << llendl;
+
+ LL_DEBUGS("Notifications") << name << LL_ENDL;
+ LL_DEBUGS("Notifications") << ll_pretty_print_sd(mFormData) << LL_ENDL;
}
LLNotificationForm::LLNotificationForm(const LLSD& sd)
@@ -515,7 +300,7 @@ std::string LLNotificationForm::getDefaultOption()
return "";
}
-LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplateParams::Notification& p)
+LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Params& p)
: mName(p.name),
mType(p.type),
mMessage(p.value),
@@ -537,7 +322,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplateParam
mSoundEffect = LLUUID(LLUI::sSettingGroups["config"]->getString(p.sound));
}
- for(LLInitParam::ParamIterator<LLNotificationTemplateParams::UniquenessContext>::const_iterator it = p.unique.contexts().begin(),
+ for(LLInitParam::ParamIterator<LLNotificationTemplate::UniquenessContext>::const_iterator it = p.unique.contexts().begin(),
end_it = p.unique.contexts().end();
it != end_it;
++it)
@@ -771,6 +556,43 @@ void LLNotification::respond(const LLSD& response)
update();
}
+const std::string& LLNotification::getName() const
+{
+ return mTemplatep->mName;
+}
+
+const std::string& LLNotification::getIcon() const
+{
+ return mTemplatep->mIcon;
+}
+
+
+bool LLNotification::isPersistent() const
+{
+ return mTemplatep->mPersist;
+}
+
+std::string LLNotification::getType() const
+{
+ return (mTemplatep ? mTemplatep->mType : "");
+}
+
+S32 LLNotification::getURLOption() const
+{
+ return (mTemplatep ? mTemplatep->mURLOption : -1);
+}
+
+S32 LLNotification::getURLOpenExternally() const
+{
+ return(mTemplatep? mTemplatep->mURLTarget == "_external": -1);
+}
+
+bool LLNotification::hasUniquenessConstraints() const
+{
+ return (mTemplatep ? mTemplatep->mUnique : false);
+}
+
+
void LLNotification::setIgnored(bool ignore)
{
mIgnored = ignore;
@@ -1400,13 +1222,13 @@ void replaceSubstitutionStrings(LLXMLNodePtr node, StringMap& replacements)
}
}
-void replaceFormText(LLNotificationTemplateParams::Form& form, const std::string& pattern, const std::string& replace)
+void replaceFormText(LLNotificationForm::Params& form, const std::string& pattern, const std::string& replace)
{
if (form.ignore.isProvided() && form.ignore.text() == pattern)
{
form.ignore.text = replace;
}
- for (LLInitParam::ParamIterator<LLNotificationTemplateParams::FormElement>::iterator it = form.form_elements.elements().begin(),
+ for (LLInitParam::ParamIterator<LLNotificationForm::FormElement>::iterator it = form.form_elements.elements().begin(),
end_it = form.form_elements.elements().end();
it != end_it;
++it)
@@ -1432,29 +1254,29 @@ bool LLNotifications::loadTemplates()
return false;
}
- LLNotificationTemplateParams::Notifications params;
+ LLNotificationTemplate::Notifications params;
LLXUIParser parser;
parser.readXUI(root, params, full_filename);
mTemplates.clear();
- for(LLInitParam::ParamIterator<LLNotificationTemplateParams::GlobalString>::const_iterator it = params.strings().begin(), end_it = params.strings().end();
+ for(LLInitParam::ParamIterator<LLNotificationTemplate::GlobalString>::const_iterator it = params.strings().begin(), end_it = params.strings().end();
it != end_it;
++it)
{
mGlobalStrings[it->name] = it->value;
}
- std::map<std::string, LLNotificationTemplateParams::Form> form_templates;
+ std::map<std::string, LLNotificationForm::Params> form_templates;
- for(LLInitParam::ParamIterator<LLNotificationTemplateParams::Template>::const_iterator it = params.templates().begin(), end_it = params.templates().end();
+ for(LLInitParam::ParamIterator<LLNotificationTemplate::Template>::const_iterator it = params.templates().begin(), end_it = params.templates().end();
it != end_it;
++it)
{
form_templates[it->name] = it->form;
}
- for(LLInitParam::ParamIterator<LLNotificationTemplateParams::Notification>::iterator it = params.notifications().begin(), end_it = params.notifications().end();
+ for(LLInitParam::ParamIterator<LLNotificationTemplate::Params>::iterator it = params.notifications().begin(), end_it = params.notifications().end();
it != end_it;
++it)
{
@@ -1532,6 +1354,8 @@ LLNotificationPtr LLNotifications::add(const LLNotification::Params& p)
void LLNotifications::add(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())
@@ -1544,6 +1368,8 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
void LLNotifications::cancel(LLNotificationPtr pNotif)
{
+ if (pNotif == NULL) return;
+
LLNotificationSet::iterator it=mItems.find(pNotif);
if (it == mItems.end())
{
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index d20b65ee1b..a58e7afe23 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -100,7 +100,6 @@
#include "llnotificationptr.h"
#include "llcachename.h"
-
typedef enum e_notification_priority
{
NOTIFICATION_PRIORITY_UNSPECIFIED,
@@ -115,13 +114,6 @@ struct NotificationPriorityValues : public LLInitParam::TypeValuesHelper<ENotifi
static void declareValues();
};
-namespace LLNotificationTemplateParams
-{
- struct Notification;
- struct Form;
- struct Template;
-};
-
class LLNotificationResponderInterface
{
public:
@@ -169,6 +161,90 @@ class LLNotificationForm
LOG_CLASS(LLNotificationForm);
public:
+ struct FormElementBase : public LLInitParam::Block<FormElementBase>
+ {
+ Mandatory<std::string> name;
+
+ FormElementBase()
+ : name("name")
+ {}
+ };
+
+ struct FormIgnore : public LLInitParam::Block<FormIgnore, FormElementBase>
+ {
+ Optional<std::string> text;
+ Optional<bool> save_option;
+
+ FormIgnore()
+ : text("text"),
+ save_option("save_option", false)
+ {}
+ };
+
+ struct FormButton : public LLInitParam::Block<FormButton, FormElementBase>
+ {
+ Mandatory<S32> index;
+ Mandatory<std::string> text;
+ Optional<std::string> ignore;
+ Optional<bool> is_default;
+
+ Mandatory<std::string> type;
+
+ FormButton()
+ : index("index"),
+ text("text"),
+ ignore("ignore"),
+ is_default("default"),
+ type("type")
+ {
+ // set type here so it gets serialized
+ type = "button";
+ }
+ };
+
+ struct FormInput : public LLInitParam::Block<FormInput, FormElementBase>
+ {
+ Mandatory<std::string> type;
+ Optional<S32> width;
+
+ FormInput()
+ : type("type"),
+ width("width", 0)
+ {}
+ };
+
+ struct FormElement : public LLInitParam::Choice<FormElement>
+ {
+ Alternative<FormButton> button;
+ Alternative<FormInput> input;
+
+ FormElement()
+ : button("button"),
+ input("input")
+ {}
+ };
+
+ struct FormElements : public LLInitParam::Block<FormElements>
+ {
+ Multiple<FormElement> elements;
+ FormElements()
+ : elements("")
+ {}
+ };
+
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Optional<std::string> name;
+ Optional<FormIgnore> ignore;
+ Optional<FormElements> form_elements;
+
+ Params()
+ : name("name"),
+ ignore("ignore"),
+ form_elements("")
+ {}
+ };
+
typedef enum e_ignore_type
{
IGNORE_NO,
@@ -179,7 +255,7 @@ public:
LLNotificationForm();
LLNotificationForm(const LLSD& sd);
- LLNotificationForm(const std::string& name, const LLNotificationTemplateParams::Form& p);
+ LLNotificationForm(const std::string& name, const Params& p);
LLSD asLLSD() const;
@@ -205,80 +281,7 @@ private:
typedef boost::shared_ptr<LLNotificationForm> LLNotificationFormPtr;
-// This is the class of object read from the XML file (notifications.xml,
-// from the appropriate local language directory).
-struct LLNotificationTemplate
-{
- LLNotificationTemplate(const LLNotificationTemplateParams::Notification& p);
- // the name of the notification -- the key used to identify it
- // Ideally, the key should follow variable naming rules
- // (no spaces or punctuation).
- std::string mName;
- // The type of the notification
- // used to control which queue it's stored in
- std::string mType;
- // The text used to display the notification. Replaceable parameters
- // are enclosed in square brackets like this [].
- std::string mMessage;
- // The label for the notification; used for
- // certain classes of notification (those with a window and a window title).
- // Also used when a notification pops up underneath the current one.
- // Replaceable parameters can be used in the label.
- std::string mLabel;
- // The name of the icon image. This should include an extension.
- std::string mIcon;
- // This is the Highlander bit -- "There Can Be Only One"
- // An outstanding notification with this bit set
- // is updated by an incoming notification with the same name,
- // rather than creating a new entry in the queue.
- // (used for things like progress indications, or repeating warnings
- // like "the grid is going down in N minutes")
- bool mUnique;
- // if we want to be unique only if a certain part of the payload is constant
- // specify the field names for the payload. The notification will only be
- // combined if all of the fields named in the context are identical in the
- // new and the old notification; otherwise, the notification will be
- // duplicated. This is to support suppressing duplicate offers from the same
- // sender but still differentiating different offers. Example: Invitation to
- // conference chat.
- std::vector<std::string> mUniqueContext;
- // If this notification expires automatically, this value will be
- // nonzero, and indicates the number of seconds for which the notification
- // will be valid (a teleport offer, for example, might be valid for
- // 300 seconds).
- U32 mExpireSeconds;
- // if the offer expires, one of the options is chosen automatically
- // based on its "value" parameter. This controls which one.
- // If expireSeconds is specified, expireOption should also be specified.
- U32 mExpireOption;
- // if the notification contains a url, it's stored here (and replaced
- // into the message where [_URL] is found)
- std::string mURL;
- // if there's a URL in the message, this controls which option visits
- // that URL. Obsolete this and eliminate the buttons for affected
- // messages when we allow clickable URLs in the UI
- U32 mURLOption;
-
- std::string mURLTarget;
- //This is a flag that tells if the url needs to open externally dispite
- //what the user setting is.
-
- // does this notification persist across sessions? if so, it will be
- // serialized to disk on first receipt and read on startup
- bool mPersist;
- // This is the name of the default functor, if present, to be
- // used for the notification's callback. It is optional, and used only if
- // the notification is constructed without an identified functor.
- std::string mDefaultFunctor;
- // The form data associated with a given notification (buttons, text boxes, etc)
- LLNotificationFormPtr mForm;
- // default priority for notifications of this type
- ENotificationPriority mPriority;
- // UUID of the audio file to be played when this notification arrives
- // this is loaded as a name, but looked up to get the UUID upon template load.
- // If null, it wasn't specified.
- LLUUID mSoundEffect;
-};
+struct LLNotificationTemplate;
// we want to keep a map of these by name, and it's best to manage them
// with smart pointers
@@ -481,15 +484,11 @@ public:
return mIgnored;
}
- const std::string& getName() const
- {
- return mTemplatep->mName;
- }
+ const std::string& getName() const;
- bool isPersistent() const
- {
- return mTemplatep->mPersist;
- }
+ const std::string& getIcon() const;
+
+ bool isPersistent() const;
const LLUUID& id() const
{
@@ -511,28 +510,12 @@ public:
return mTimestamp;
}
- std::string getType() const
- {
- return (mTemplatep ? mTemplatep->mType : "");
- }
-
+ std::string getType() const;
std::string getMessage() const;
std::string getLabel() const;
-
std::string getURL() const;
-// {
-// return (mTemplatep ? mTemplatep->mURL : "");
-// }
-
- S32 getURLOption() const
- {
- return (mTemplatep ? mTemplatep->mURLOption : -1);
- }
-
- S32 getURLOpenExternally() const
- {
- return(mTemplatep? mTemplatep->mURLTarget == "_external": -1);
- }
+ S32 getURLOption() const;
+ S32 getURLOpenExternally() const;
const LLNotificationFormPtr getForm();
@@ -602,7 +585,7 @@ public:
std::string summarize() const;
- bool hasUniquenessConstraints() const { return (mTemplatep ? mTemplatep->mUnique : false);}
+ bool hasUniquenessConstraints() const;
virtual ~LLNotification() {}
};
diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h
new file mode 100644
index 0000000000..4a020bfe70
--- /dev/null
+++ b/indra/llui/llnotificationtemplate.h
@@ -0,0 +1,274 @@
+/**
+* @file llnotificationtemplate.h
+* @brief Description of notification contents
+* @author Q (with assistance from Richard and Coco)
+*
+* $LicenseInfo:firstyear=2008&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2010, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+* $/LicenseInfo$
+*/
+
+#ifndef LL_LLNOTIFICATION_TEMPLATE_H
+#define LL_LLNOTIFICATION_TEMPLATE_H
+
+//#include <string>
+//#include <list>
+//#include <vector>
+//#include <map>
+//#include <set>
+//#include <iomanip>
+//#include <sstream>
+//
+//#include <boost/utility.hpp>
+//#include <boost/shared_ptr.hpp>
+//#include <boost/enable_shared_from_this.hpp>
+//#include <boost/type_traits.hpp>
+//
+//// we want to minimize external dependencies, but this one is important
+//#include "llsd.h"
+//
+//// and we need this to manage the notification callbacks
+//#include "llevents.h"
+//#include "llfunctorregistry.h"
+//#include "llpointer.h"
+#include "llinitparam.h"
+//#include "llnotificationslistener.h"
+//#include "llnotificationptr.h"
+//#include "llcachename.h"
+#include "llnotifications.h"
+
+
+typedef boost::shared_ptr<LLNotificationForm> LLNotificationFormPtr;
+
+// This is the class of object read from the XML file (notifications.xml,
+// from the appropriate local language directory).
+struct LLNotificationTemplate
+{
+ struct GlobalString : public LLInitParam::Block<GlobalString>
+ {
+ Mandatory<std::string> name,
+ value;
+
+ GlobalString()
+ : name("name"),
+ value("value")
+ {}
+ };
+
+ struct UniquenessContext : public LLInitParam::Block<UniquenessContext>
+ {
+ Mandatory<std::string> key;
+
+ UniquenessContext()
+ : key("key")
+ {}
+
+ };
+
+ struct UniquenessConstraint : public LLInitParam::Block<UniquenessConstraint>
+ {
+ Multiple<UniquenessContext> contexts;
+
+ UniquenessConstraint()
+ : contexts("context")
+ {}
+ };
+
+ // Templates are used to define common form types, such as OK/Cancel dialogs, etc.
+
+ struct Template : public LLInitParam::Block<Template>
+ {
+ Mandatory<std::string> name;
+ Mandatory<LLNotificationForm::Params> form;
+
+ Template()
+ : name("name"),
+ form("form")
+ {}
+ };
+
+ // Reference a template to use its form elements
+ struct TemplateRef : public LLInitParam::Block<TemplateRef>
+ {
+ Mandatory<std::string> name;
+ Optional<std::string> yes_text,
+ no_text,
+ cancel_text,
+ ignore_text;
+
+ TemplateRef()
+ : name("name"),
+ yes_text("yestext"),
+ no_text("notext"),
+ cancel_text("canceltext"),
+ ignore_text("ignoretext")
+ {}
+ };
+
+ struct URL : public LLInitParam::Block<URL>
+ {
+ Mandatory<S32> option;
+ Mandatory<std::string> value;
+ Optional<std::string> target;
+ Ignored name;
+
+ URL()
+ : option("option", -1),
+ value("value"),
+ target("target", "_blank"),
+ name("name")
+ {}
+ };
+
+ struct FormRef : public LLInitParam::Choice<FormRef>
+ {
+ Alternative<LLNotificationForm::Params> form;
+ Alternative<TemplateRef> form_template;
+
+ FormRef()
+ : form("form"),
+ form_template("usetemplate")
+ {}
+ };
+
+ struct Params : public LLInitParam::Block<Params>
+ {
+ Mandatory<std::string> name;
+ Optional<bool> persist;
+ Optional<std::string> functor,
+ icon,
+ label,
+ sound,
+ type,
+ value;
+ Optional<U32> duration;
+ Optional<S32> expire_option;
+ Optional<URL> url;
+ Optional<UniquenessConstraint> unique;
+ Optional<FormRef> form_ref;
+ Optional<ENotificationPriority,
+ NotificationPriorityValues> priority;
+
+
+ Params()
+ : name("name"),
+ persist("persist", false),
+ functor("functor"),
+ icon("icon"),
+ label("label"),
+ priority("priority"),
+ sound("sound"),
+ type("type"),
+ value("value"),
+ duration("duration"),
+ expire_option("expireOption", -1),
+ url("url"),
+ unique("unique"),
+ form_ref("")
+ {}
+
+ };
+
+ struct Notifications : public LLInitParam::Block<Notifications>
+ {
+ Multiple<GlobalString> strings;
+ Multiple<Template> templates;
+ Multiple<Params> notifications;
+
+ Notifications()
+ : strings("global"),
+ notifications("notification"),
+ templates("template")
+ {}
+ };
+
+ LLNotificationTemplate(const Params& p);
+ // the name of the notification -- the key used to identify it
+ // Ideally, the key should follow variable naming rules
+ // (no spaces or punctuation).
+ std::string mName;
+ // The type of the notification
+ // used to control which queue it's stored in
+ std::string mType;
+ // The text used to display the notification. Replaceable parameters
+ // are enclosed in square brackets like this [].
+ std::string mMessage;
+ // The label for the notification; used for
+ // certain classes of notification (those with a window and a window title).
+ // Also used when a notification pops up underneath the current one.
+ // Replaceable parameters can be used in the label.
+ std::string mLabel;
+ // The name of the icon image. This should include an extension.
+ std::string mIcon;
+ // This is the Highlander bit -- "There Can Be Only One"
+ // An outstanding notification with this bit set
+ // is updated by an incoming notification with the same name,
+ // rather than creating a new entry in the queue.
+ // (used for things like progress indications, or repeating warnings
+ // like "the grid is going down in N minutes")
+ bool mUnique;
+ // if we want to be unique only if a certain part of the payload is constant
+ // specify the field names for the payload. The notification will only be
+ // combined if all of the fields named in the context are identical in the
+ // new and the old notification; otherwise, the notification will be
+ // duplicated. This is to support suppressing duplicate offers from the same
+ // sender but still differentiating different offers. Example: Invitation to
+ // conference chat.
+ std::vector<std::string> mUniqueContext;
+ // If this notification expires automatically, this value will be
+ // nonzero, and indicates the number of seconds for which the notification
+ // will be valid (a teleport offer, for example, might be valid for
+ // 300 seconds).
+ U32 mExpireSeconds;
+ // if the offer expires, one of the options is chosen automatically
+ // based on its "value" parameter. This controls which one.
+ // If expireSeconds is specified, expireOption should also be specified.
+ U32 mExpireOption;
+ // if the notification contains a url, it's stored here (and replaced
+ // into the message where [_URL] is found)
+ std::string mURL;
+ // if there's a URL in the message, this controls which option visits
+ // that URL. Obsolete this and eliminate the buttons for affected
+ // messages when we allow clickable URLs in the UI
+ U32 mURLOption;
+
+ std::string mURLTarget;
+ //This is a flag that tells if the url needs to open externally dispite
+ //what the user setting is.
+
+ // does this notification persist across sessions? if so, it will be
+ // serialized to disk on first receipt and read on startup
+ bool mPersist;
+ // This is the name of the default functor, if present, to be
+ // used for the notification's callback. It is optional, and used only if
+ // the notification is constructed without an identified functor.
+ std::string mDefaultFunctor;
+ // The form data associated with a given notification (buttons, text boxes, etc)
+ LLNotificationFormPtr mForm;
+ // default priority for notifications of this type
+ ENotificationPriority mPriority;
+ // UUID of the audio file to be played when this notification arrives
+ // this is loaded as a name, but looked up to get the UUID upon template load.
+ // If null, it wasn't specified.
+ LLUUID mSoundEffect;
+};
+
+#endif //LL_LLNOTIFICATION_TEMPLATE_H
+