diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:46:13 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:46:13 +0000 |
commit | d8f98565a8617658f610bc94a5d87266930beee4 (patch) | |
tree | 365a153c59bc8b521b094c27f25b484a69e5154b /src/modules | |
parent | 984cc96a1f832abf9b5fcfddcd8260c5b12bd2a9 (diff) |
Use ConfigTagList as a faster access method for access to configuration
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11948 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_alias.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_opermodes.cpp | 18 | ||||
-rw-r--r-- | src/modules/m_restrictchans.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 21 | ||||
-rw-r--r-- | src/modules/m_vhost.cpp | 7 |
6 files changed, 24 insertions, 43 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 8a58e3dd4..a5f543508 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -73,11 +73,10 @@ class ModuleAlias : public Module fprefix = fpre.empty() ? '!' : fpre[0]; Aliases.clear(); - for (int i = 0;; i++) + ConfigTagList tags = ServerInstance->Config->ConfTags("alias"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("alias", i); - if (!tag) - break; + ConfigTag* tag = i->second; Alias a; a.AliasedCommand = tag->getString("text").c_str(); tag->readString("replace", a.ReplaceFormat, true); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 8f19bd72b..43da5b4ac 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -133,11 +133,10 @@ class ModuleHelpop : public Module helpop_map.clear(); - for (int i = 0;; i++) + ConfigTagList tags = ServerInstance->Config->ConfTags("helpop"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("helpop", i); - if (!tag) - break; + ConfigTag* tag = i->second; irc::string key = assign(tag->getString("key")); std::string value; tag->readString("value", value, true); /* Linefeeds allowed */ diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 6b5ca10f9..94a9eefe9 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -49,22 +49,10 @@ class ModuleModesOnOper : public Module ApplyModes(user, ThisOpersModes); } - if (!opername.empty()) // if user is local .. + ThisOpersModes = user->oper->getConfig("modes"); + if (!ThisOpersModes.empty()) { - for (int i = 0;; i++) - { - ConfigTag* tag = ServerInstance->Config->ConfValue("oper", i); - if (!tag) - break; - if (tag->getString("name") != opername) - continue; - ThisOpersModes = tag->getString("modes"); - if (!ThisOpersModes.empty()) - { - ApplyModes(user, ThisOpersModes); - } - break; - } + ApplyModes(user, ThisOpersModes); } } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 8cc882d90..557515fe0 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -22,11 +22,10 @@ class ModuleRestrictChans : public Module void ReadConfig() { allowchans.clear(); - for (int i = 0;; i++) + ConfigTagList tags = ServerInstance->Config->ConfTags("allowchannel"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("allowchannel", i); - if (!tag) - return; + ConfigTag* tag = i->second; std::string txt = tag->getString("name"); allowchans.insert(txt.c_str()); } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index b8560aaba..10a888833 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -368,11 +368,10 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) if (rebind) { - for (int j = 0; ; j++) + ConfigTagList tags = ServerInstance->Config->ConfTags("bind"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("bind", j); - if (!tag) - break; + ConfigTag* tag = i->second; std::string Type = tag->getString("type"); std::string IP = tag->getString("address"); std::string Port = tag->getString("port"); @@ -417,11 +416,10 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) AutoconnectBlocks.clear(); LinkBlocks.clear(); ValidIPs.clear(); - for (int j = 0;; ++j) + ConfigTagList tags = ServerInstance->Config->ConfTags("link"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("link", j); - if (!tag) - break; + ConfigTag* tag = i->second; reference<Link> L = new Link(tag); L->Name = tag->getString("name").c_str(); L->AllowMask = tag->getString("allowmask"); @@ -479,11 +477,10 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) LinkBlocks.push_back(L); } - for (int j = 0;; ++j) + tags = ServerInstance->Config->ConfTags("autoconnect"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("autoconnect", j); - if (!tag) - break; + ConfigTag* tag = i->second; reference<Autoconnect> A = new Autoconnect(tag); A->Period = tag->getInt("period"); A->NextConnectTime = ServerInstance->Time() + A->Period; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 18c2a1eb0..1fac18514 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -27,11 +27,10 @@ class CommandVhost : public Command CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { - for (int index = 0;; index++) + ConfigTagList tags = ServerInstance->Config->ConfTags("vhost"); + for(ConfigIter i = tags.first; i != tags.second; ++i) { - ConfigTag* tag = ServerInstance->Config->ConfValue("vhost", index); - if (!tag) - break; + ConfigTag* tag = i->second; std::string mask = tag->getString("host"); std::string username = tag->getString("user"); std::string pass = tag->getString("pass"); |