summaryrefslogtreecommitdiff
path: root/src/config.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-12-15 02:29:13 -0500
committerAdam <Adam@anope.org>2011-12-15 02:29:13 -0500
commitc88a751eab55b5524395796734beb5bb15811d61 (patch)
tree7ff0f6d31c260c01374a373b897031736a085601 /src/config.cpp
parent9ea030d0600624095204af192e99c16e2d78a42e (diff)
Add privilege ranks to determine how powerful privileges are
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/config.cpp b/src/config.cpp
index 2bde3863a..63aaf1bf3 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -884,6 +884,7 @@ static bool DoPrivileges(ServerConfig *config, const Anope::string &, const Anop
{
Anope::string name = values[0].GetValue();
Anope::string desc = values[1].GetValue();
+ Anope::string rank = values[2].GetValue();
ValueItem vi(name);
if (!ValidateNotEmpty(config, "privilege", "name", vi))
@@ -892,8 +893,15 @@ static bool DoPrivileges(ServerConfig *config, const Anope::string &, const Anop
vi = ValueItem(desc);
if (!ValidateNotEmpty(config, "privilege", "desc", vi))
throw ConfigException("One or more values in your configuration file failed to validate. Please see your log for more information.");
+
+ int irank = 0;
+ try
+ {
+ irank = convertTo<int>(rank);
+ }
+ catch (const ConvertException &) { }
- PrivilegeManager::AddPrivilege(Privilege(name, desc));
+ PrivilegeManager::AddPrivilege(Privilege(name, desc, irank));
return true;
}
@@ -1330,9 +1338,9 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitCommands, DoCommands, DoneCommands},
{"privilege",
- {"name", "desc", ""},
- {"", "", ""},
- {DT_STRING, DT_STRING, DT_STRING},
+ {"name", "desc", "rank", ""},
+ {"", "", "", ""},
+ {DT_STRING, DT_STRING, DT_STRING, DT_STRING},
InitPrivileges, DoPrivileges, DonePrivileges},
{"",
{""},