summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_operjoin.cpp24
-rw-r--r--src/modules/m_override.cpp25
-rw-r--r--src/modules/m_permchannels.cpp13
3 files changed, 15 insertions, 47 deletions
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index 0c8975247..52901fe6f 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -20,7 +20,6 @@ class ModuleOperjoin : public Module
private:
std::string operChan;
std::vector<std::string> operChans;
- std::map<std::string, std::vector<std::string> > operTypeChans; // Channels specific to an oper type.
bool override;
int tokenize(const std::string &str, std::vector<std::string> &tokens)
@@ -60,18 +59,6 @@ class ModuleOperjoin : public Module
operChans.clear();
if (!operChan.empty())
tokenize(operChan,operChans);
-
- std::map<std::string, std::vector<std::string> >().swap(operTypeChans);
-
- int olines = conf.Enumerate("type");
- for (int index = 0; index < olines; ++index)
- {
- std::string chanList = conf.ReadValue("type", "autojoin", index);
- if (!chanList.empty())
- {
- tokenize(chanList, operTypeChans[conf.ReadValue("type", "name", index)]);
- }
- }
}
virtual ~ModuleOperjoin()
@@ -92,12 +79,12 @@ class ModuleOperjoin : public Module
if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time());
- std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper->name);
-
- if (i != operTypeChans.end())
+ std::string chanList = IS_OPER(user)->getConfig("autojoin");
+ if (!chanList.empty())
{
- const std::vector<std::string>& list = i->second;
- for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it)
+ std::vector<std::string> typechans;
+ tokenize(chanList, typechans);
+ for (std::vector<std::string>::const_iterator it = typechans.begin(); it != typechans.end(); ++it)
{
if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
{
@@ -106,7 +93,6 @@ class ModuleOperjoin : public Module
}
}
}
-
};
MODULE_INIT(ModuleOperjoin)
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 982f65853..3131ab4b2 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -15,11 +15,8 @@
/* $ModDesc: Provides support for unreal-style oper-override */
-typedef std::map<std::string,std::string> override_t;
-
class ModuleOverride : public Module
{
- override_t overrides;
bool RequireKey;
bool NoisyOverride;
@@ -42,15 +39,6 @@ class ModuleOverride : public Module
// re-read our config options on a rehash
NoisyOverride = Conf.ReadFlag("override", "noisy", 0);
RequireKey = Conf.ReadFlag("override", "requirekey", 0);
-
- overrides.clear();
-
- for (int j =0; j < Conf.Enumerate("type"); j++)
- {
- std::string typen = Conf.ReadValue("type","name",j);
- std::string tokenlist = Conf.ReadValue("type","override",j);
- overrides[typen] = tokenlist;
- }
}
void On005Numeric(std::string &output)
@@ -60,17 +48,10 @@ class ModuleOverride : public Module
bool CanOverride(User* source, const char* token)
{
- // checks to see if the oper's type has <type:override>
- override_t::iterator j = overrides.find(source->oper->name);
-
- if (j != overrides.end())
- {
- // its defined or * is set, return its value as a boolean for if the token is set
- return ((j->second.find(token, 0) != std::string::npos) || (j->second.find("*", 0) != std::string::npos));
- }
+ std::string tokenlist = source->oper->getConfig("override");
- // its not defined at all, count as false
- return false;
+ // its defined or * is set, return its value as a boolean for if the token is set
+ return ((tokenlist.find(token, 0) != std::string::npos) || (tokenlist.find("*", 0) != std::string::npos));
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index fbbd38c15..e3d18cc33 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -217,15 +217,16 @@ public:
* Process config-defined list of permanent channels.
* -- w00t
*/
- ConfigReader MyConf;
- permchannelsconf = MyConf.ReadValue("permchanneldb", "filename", "", 0, false);
+ permchannelsconf = ServerInstance->Config->ConfValue("permchanneldb")->getString("filename");
- for (int i = 0; i < MyConf.Enumerate("permchannels"); i++)
+ ConfigTagList permchannels = ServerInstance->Config->ConfTags("permchannels");
+ for (ConfigIter i = permchannels.first; i != permchannels.second; ++i)
{
- std::string channel = MyConf.ReadValue("permchannels", "channel", i);
- std::string topic = MyConf.ReadValue("permchannels", "topic", i);
- std::string modes = MyConf.ReadValue("permchannels", "modes", i);
+ ConfigTag* tag = i->second;
+ std::string channel = tag->getString("channel");
+ std::string topic = tag->getString("topic");
+ std::string modes = tag->getString("modes");
if (channel.empty())
{