summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-21 23:22:04 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-21 23:22:04 +0000
commit06fd57cc35c9d5869ca3a24d349b791963b2acc4 (patch)
tree14a968c830b6941dd766e9d3ddd71435e82e9e24 /src
parent97cf2d2384e255d8e77af7b70fdc057461b83c38 (diff)
fix for bug #175, change OnUserRegister to return int, and if greater than 0 = user was quit and stop propagating to rest of loaded modules. Also bumb the module API version.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5783 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/cmd_user.cpp6
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/extra/m_sqlauth.cpp6
-rw-r--r--src/modules/m_antibear.cpp3
-rw-r--r--src/modules/m_cgiirc.cpp6
-rw-r--r--src/modules/m_conn_waitpong.cpp3
-rw-r--r--src/modules/m_connflood.cpp9
-rw-r--r--src/modules/m_ident.cpp3
8 files changed, 24 insertions, 14 deletions
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 208e04380..66ee2c75d 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -54,10 +54,14 @@ CmdResult cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
/* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
if (user->registered == REG_NICKUSER)
{
+ int MOD_RESULT = 0;
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
if (ServerInstance->next_call > ServerInstance->Time() + ServerInstance->Config->dns_timeout)
ServerInstance->next_call = ServerInstance->Time() + ServerInstance->Config->dns_timeout;
- FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
+ FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
+ if (MOD_RESULT > 0)
+ return CMD_FAILURE;
+
}
return CMD_SUCCESS;
diff --git a/src/modules.cpp b/src/modules.cpp
index 03c951fe7..8f5e427d9 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -135,7 +135,7 @@ void Module::OnBackgroundTimer(time_t curtime) { };
int Module::OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) { return 0; };
void Module::OnPostCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, CmdResult result, const std::string &original_line) { };
bool Module::OnCheckReady(userrec* user) { return true; };
-void Module::OnUserRegister(userrec* user) { };
+int Module::OnUserRegister(userrec* user) { return 0; };
int Module::OnUserPreKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { return 0; };
void Module::OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { };
int Module::OnCheckInvite(userrec* user, chanrec* chan) { return 0; };
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index 8f9a850ab..3e1162a77 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -87,18 +87,20 @@ public:
}
}
- virtual void OnUserRegister(userrec* user)
+ virtual int OnUserRegister(userrec* user)
{
if ((allowpattern != "") && (Srv->MatchText(user->nick,allowpattern)))
{
user->Extend("sqlauthed");
- return;
+ return 0;
}
if (!CheckCredentials(user))
{
userrec::QuitUser(Srv,user,killreason);
+ return 1;
}
+ return 0;
}
bool CheckCredentials(userrec* user)
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp
index 513f357f9..0f67915ef 100644
--- a/src/modules/m_antibear.cpp
+++ b/src/modules/m_antibear.cpp
@@ -47,10 +47,11 @@ class ModuleAntiBear : public Module
List[I_OnUserRegister] = 1;
}
- virtual void OnUserRegister(userrec* user)
+ virtual int OnUserRegister(userrec* user)
{
user->WriteServ("439 %s :This server has anti-spambot mechanisms enabled.", user->nick);
user->WriteServ("931 %s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick);
+ return 0;
}
};
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index ec2ac6129..092677bd2 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -196,7 +196,7 @@ public:
}
- virtual void OnUserRegister(userrec* user)
+ virtual int OnUserRegister(userrec* user)
{
ServerInstance->Log(DEBUG, "m_cgiirc.so: User %s registering, %s %s", user->nick,user->host,user->GetIPString());
@@ -227,10 +227,10 @@ public:
// If the ident lookup fails, try the password.
CheckPass(user);
}
-
- return;
+ return 0;
}
}
+ return 0;
}
bool CheckPass(userrec* user)
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index 1806a988f..8d62357cd 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -67,7 +67,7 @@ class ModuleWaitPong : public Module
List[I_OnUserRegister] = List[I_OnCheckReady] = List[I_OnPreCommand] = List[I_OnRehash] = List[I_OnUserDisconnect] = List[I_OnCleanup] = 1;
}
- virtual void OnUserRegister(userrec* user)
+ virtual int OnUserRegister(userrec* user)
{
char* pingrpl = RandString(10);
@@ -77,6 +77,7 @@ class ModuleWaitPong : public Module
user->WriteServ("NOTICE %s :*** If you are having problems connecting due to ping timeouts, please type /quote PONG %s or /raw PONG %s now.", user->nick, pingrpl, pingrpl);
user->Extend("waitpong_pingstr", pingrpl);
+ return 0;
}
virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec* user, bool validated, const std::string &original_line)
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index 585891f74..a226fa189 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -74,7 +74,7 @@ public:
first = ServerInstance->Time();
}
- virtual void OnUserRegister(userrec* user)
+ virtual int OnUserRegister(userrec* user)
{
time_t next = ServerInstance->Time();
if (!first)
@@ -93,10 +93,10 @@ public:
/* expire throttle */
throttled = 0;
ServerInstance->WriteOpers("*** Connection throttle deactivated");
- return;
+ return 0;
}
userrec::QuitUser(ServerInstance, user, quitmsg);
- return;
+ return 1;
}
if (tdiff <= seconds)
@@ -106,7 +106,7 @@ public:
throttled = 1;
ServerInstance->WriteOpers("*** Connection throttle activated");
userrec::QuitUser(ServerInstance, user, quitmsg);
- return;
+ return 1;
}
}
else
@@ -114,6 +114,7 @@ public:
conns = 1;
first = next;
}
+ return 0;
}
virtual void OnRehash(const std::string &parameter)
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index f4ffc0058..dc59adcea 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -208,7 +208,7 @@ class ModuleIdent : public Module
ReadSettings();
}
- virtual void OnUserRegister(userrec* user)
+ virtual int OnUserRegister(userrec* user)
{
/*
* when the new user connects, before they authenticate with USER/NICK/PASS, we do
@@ -231,6 +231,7 @@ class ModuleIdent : public Module
strlcpy(user->ident,newident,IDENTMAX);
delete ident;
}
+ return 0;
}
virtual bool OnCheckReady(userrec* user)