summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h4
-rw-r--r--src/modules/m_cgiirc.cpp6
-rw-r--r--src/users.cpp38
3 files changed, 30 insertions, 18 deletions
diff --git a/include/users.h b/include/users.h
index b310e2129..4b16c09be 100644
--- a/include/users.h
+++ b/include/users.h
@@ -683,6 +683,10 @@ class CoreExport User : public connection
*/
User(InspIRCd* Instance, const std::string &uid = "");
+ /** Check if the user matches a G or K line, and disconnect them if they do
+ */
+ void CheckLines();
+
/** Returns the full displayed host of the user
* This member function returns the hostname of the user as seen by other users
* on the server, in nick!ident&at;host form.
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 7860b8a6e..fb03fd1ba 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -114,6 +114,7 @@ class CGIResolver : public Resolver
strlcpy(them->dhost, result.c_str(), 63);
strlcpy(them->ident, "~cgiirc", 8);
them->InvalidateCache();
+ them->CheckLines();
}
}
@@ -267,20 +268,24 @@ public:
if(iter->type == PASS)
{
CheckPass(user); // We do nothing if it fails so...
+ user->CheckLines();
}
else if(iter->type == PASSFIRST && !CheckPass(user))
{
// If the password lookup failed, try the ident
CheckIdent(user); // If this fails too, do nothing
+ user->CheckLines();
}
else if(iter->type == IDENT)
{
CheckIdent(user); // Nothing on failure.
+ user->CheckLines();
}
else if(iter->type == IDENTFIRST && !CheckIdent(user))
{
// If the ident lookup fails, try the password.
CheckPass(user);
+ user->CheckLines();
}
else if(iter->type == WEBIRC)
{
@@ -323,6 +328,7 @@ public:
ServerInstance->Users->AddLocalClone(user);
ServerInstance->Users->AddGlobalClone(user);
user->CheckClass();
+ user->CheckLines();
}
}
diff --git a/src/users.cpp b/src/users.cpp
index cdacdc5c2..5b46d172c 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -859,6 +859,25 @@ void User::CheckClass()
this->MaxChans = a->GetMaxChans();
}
+void User::CheckLines()
+{
+ char* check[] = { "G" , "K", NULL };
+
+ if (!this->exempt)
+ {
+ for (int n = 0; check[n]; ++n)
+ {
+ XLine *r = ServerInstance->XLines->MatchesLine(check[n], this);
+
+ if (r)
+ {
+ r->Apply(this);
+ return;
+ }
+ }
+ }
+}
+
void User::FullConnect()
{
ServerInstance->stats->statsConnects++;
@@ -881,24 +900,7 @@ void User::FullConnect()
return;
}
- if (!this->exempt)
- {
- GLine *r = (GLine *)ServerInstance->XLines->MatchesLine("G", this);
-
- if (r)
- {
- r->Apply(this);
- return;
- }
-
- KLine *n = (KLine *)ServerInstance->XLines->MatchesLine("K", this);
-
- if (n)
- {
- n->Apply(this);
- return;
- }
- }
+ CheckLines();
this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network);
this->WriteNumeric(001, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick, ServerInstance->Config->Network, this->nick, this->ident, this->host);