summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_conn_umodes.cpp61
-rw-r--r--src/modules/m_ident.cpp23
2 files changed, 25 insertions, 59 deletions
diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp
index 2ad8ab876..0fcd73fe9 100644
--- a/src/modules/m_conn_umodes.cpp
+++ b/src/modules/m_conn_umodes.cpp
@@ -17,14 +17,8 @@
class ModuleModesOnConnect : public Module
{
- private:
-
- ConfigReader *Conf;
-
public:
ModuleModesOnConnect() {
-
- Conf = new ConfigReader;
Implementation eventlist[] = { I_OnUserConnect, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
// for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t
@@ -32,15 +26,8 @@ class ModuleModesOnConnect : public Module
}
- virtual void OnRehash(User* user)
- {
- delete Conf;
- Conf = new ConfigReader;
- }
-
virtual ~ModuleModesOnConnect()
{
- delete Conf;
}
virtual Version GetVersion()
@@ -59,41 +46,33 @@ class ModuleModesOnConnect : public Module
sizeof(ServerInstance->Config->DisabledUModes));
memset(ServerInstance->Config->DisabledUModes, 0, 64);
- for (int j = 0; j < Conf->Enumerate("connect"); j++)
+ ConfigTag* tag = user->MyClass->config;
+ std::string ThisModes = tag->getString("modes");
+ if (!ThisModes.empty())
{
- std::string hostn = Conf->ReadValue("connect","allow",j);
- /* XXX: Fixme: does not respect port, limit, etc */
- if ((InspIRCd::MatchCIDR(user->GetIPString(),hostn, ascii_case_insensitive_map)) || (InspIRCd::Match(user->host,hostn, ascii_case_insensitive_map)))
- {
- std::string ThisModes = Conf->ReadValue("connect","modes",j);
- if (!ThisModes.empty())
- {
- std::string buf;
- std::stringstream ss(ThisModes);
-
- std::vector<std::string> tokens;
+ std::string buf;
+ std::stringstream ss(ThisModes);
- // split ThisUserModes into modes and mode params
- while (ss >> buf)
- tokens.push_back(buf);
+ std::vector<std::string> tokens;
- std::vector<std::string> modes;
- modes.push_back(user->nick);
- modes.push_back(tokens[0]);
+ // split ThisUserModes into modes and mode params
+ while (ss >> buf)
+ tokens.push_back(buf);
- if (tokens.size() > 1)
- {
- // process mode params
- for (unsigned int k = 1; k < tokens.size(); k++)
- {
- modes.push_back(tokens[k]);
- }
- }
+ std::vector<std::string> modes;
+ modes.push_back(user->nick);
+ modes.push_back(tokens[0]);
- ServerInstance->Parser->CallHandler("MODE", modes, user);
+ if (tokens.size() > 1)
+ {
+ // process mode params
+ for (unsigned int k = 1; k < tokens.size(); k++)
+ {
+ modes.push_back(tokens[k]);
}
- break;
}
+
+ ServerInstance->Parser->CallHandler("MODE", modes, user);
}
memcpy(ServerInstance->Config->DisabledUModes, save, 64);
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 0ba9e6e3a..56fa47db8 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -276,12 +276,10 @@ class IdentRequestSocket : public EventHandler
class ModuleIdent : public Module
{
int RequestTimeout;
- ConfigReader *Conf;
SimpleExtItem<IdentRequestSocket> ext;
public:
ModuleIdent() : ext("ident_socket", this)
{
- Conf = new ConfigReader;
OnRehash(NULL);
Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnUserDisconnect };
ServerInstance->Modules->Attach(eventlist, this, 4);
@@ -289,7 +287,6 @@ class ModuleIdent : public Module
~ModuleIdent()
{
- delete Conf;
}
virtual Version GetVersion()
@@ -299,28 +296,18 @@ class ModuleIdent : public Module
virtual void OnRehash(User *user)
{
- delete Conf;
- Conf = new ConfigReader;
+ ConfigReader Conf;
- RequestTimeout = Conf->ReadInteger("ident", "timeout", 0, true);
+ RequestTimeout = Conf.ReadInteger("ident", "timeout", 0, true);
if (!RequestTimeout)
RequestTimeout = 5;
}
virtual ModResult OnUserRegister(User *user)
{
- for (int j = 0; j < Conf->Enumerate("connect"); j++)
- {
- std::string hostn = Conf->ReadValue("connect","allow",j);
- /* XXX: Fixme: does not respect port, limit, etc */
- if ((InspIRCd::MatchCIDR(user->GetIPString(),hostn, ascii_case_insensitive_map)) || (InspIRCd::Match(user->host,hostn, ascii_case_insensitive_map)))
- {
- bool useident = Conf->ReadFlag("connect", "useident", "yes", j);
-
- if (!useident)
- return MOD_RES_PASSTHRU;
- }
- }
+ ConfigTag* tag = user->MyClass->config;
+ if (!tag->getBool("useident", true))
+ return MOD_RES_PASSTHRU;
/* User::ident is currently the username field from USER; with m_ident loaded, that
* should be preceded by a ~. The field is actually IdentMax+2 characters wide. */