summaryrefslogtreecommitdiffstats
path: root/src/configreader.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-03-07 19:06:32 -0600
committerGravatar Daniel De Graaf2010-08-03 17:32:39 -0400
commit907722538cf76f8937bf82f1680cdba32bdb282b (patch)
treee26537c82f7b2dd41d096b0e42149d9b03295b60 /src/configreader.cpp
parentMove "topic" permisison back to "exempt/topiclock" like 2.0 (diff)
downloadinspircd++-907722538cf76f8937bf82f1680cdba32bdb282b.tar.gz
inspircd++-907722538cf76f8937bf82f1680cdba32bdb282b.tar.bz2
inspircd++-907722538cf76f8937bf82f1680cdba32bdb282b.zip
Change OperInfo to store oper/type/class together.
This allows privelages to be granted using <oper:commands> or <type:commands> instead of requiring <class> blocks.
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r--src/configreader.cpp41
1 files changed, 4 insertions, 37 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index a989a704c..b65e117aa 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -202,10 +202,8 @@ static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::str
}
}
-typedef std::map<std::string, ConfigTag*> LocalIndex;
void ServerConfig::CrossCheckOperClassType()
{
- LocalIndex operclass;
ConfigTagList tags = ConfTags("class");
for(ConfigIter i = tags.first; i != tags.second; ++i)
{
@@ -213,8 +211,9 @@ void ServerConfig::CrossCheckOperClassType()
std::string name = tag->getString("name");
if (name.empty())
throw CoreException("<class:name> missing from tag at " + tag->getTagLocation());
- operclass[name] = tag;
+ oper_classes[name] = tag;
}
+
tags = ConfTags("type");
for(ConfigIter i = tags.first; i != tags.second; ++i)
{
@@ -226,20 +225,7 @@ void ServerConfig::CrossCheckOperClassType()
if (!ServerInstance->IsNick(name.c_str(), Limits.NickMax))
throw CoreException("<type:name> is invalid (value '" + name + "')");
- OperInfo* ifo = new OperInfo;
- oper_blocks[" " + name] = ifo;
- ifo->name = name;
- ifo->type_block = tag;
-
- std::string classname;
- irc::spacesepstream str(tag->getString("classes"));
- while (str.GetToken(classname))
- {
- LocalIndex::iterator cls = operclass.find(classname);
- if (cls == operclass.end())
- throw CoreException("Oper type " + name + " has missing class " + classname);
- ifo->class_blocks.push_back(cls->second);
- }
+ oper_blocks[" " + name] = new OperInfo(tag);
}
tags = ConfTags("oper");
@@ -251,29 +237,10 @@ void ServerConfig::CrossCheckOperClassType()
if (name.empty())
throw CoreException("<oper:name> missing from tag at " + tag->getTagLocation());
- std::string type = tag->getString("type");
- OperIndex::iterator tblk = oper_blocks.find(" " + type);
- if (tblk == oper_blocks.end())
- throw CoreException("Oper block " + name + " has missing type " + type);
if (oper_blocks.find(name) != oper_blocks.end())
throw CoreException("Duplicate oper block with name " + name);
- OperInfo* ifo = new OperInfo;
- ifo->name = type;
- ifo->oper_block = tag;
- ifo->type_block = tblk->second->type_block;
- ifo->class_blocks.assign(tblk->second->class_blocks.begin(), tblk->second->class_blocks.end());
- oper_blocks[name] = ifo;
-
- std::string classname;
- irc::spacesepstream str(tag->getString("classes"));
- while (str.GetToken(classname))
- {
- LocalIndex::iterator cls = operclass.find(classname);
- if (cls == operclass.end())
- throw CoreException("Oper " + name + " has missing class " + classname);
- ifo->class_blocks.push_back(cls->second);
- }
+ oper_blocks[name] = new OperInfo(tag);
}
}