summaryrefslogtreecommitdiff
path: root/src/xline.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-26 13:57:39 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-26 13:57:39 +0000
commit32c49435b2f6408984debc7665c502ec317e0cd0 (patch)
treeb31722696c8e11db858b8e0c53171691332eb863 /src/xline.cpp
parent93784202ea97ee120ff9b5450a37e2ad26cca381 (diff)
Incrased speed of apply_lines() (was too slow when banning 100 users)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@735 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/xline.cpp')
-rw-r--r--src/xline.cpp96
1 files changed, 44 insertions, 52 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index c8aa4872a..bb254d22a 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -541,6 +541,9 @@ void apply_lines()
char reason[MAXBUF];
char host[MAXBUF];
+ if ((!glines.size()) && (!klines.size()) && (!zlines.size()) && (!qlines.size()))
+ return;
+
while (go_again)
{
go_again = false;
@@ -549,68 +552,57 @@ void apply_lines()
if (!strcasecmp(u->second->server,ServerName))
{
snprintf(host,MAXBUF,"%s@%s",u->second->ident,u->second->host);
- char* check = matches_gline(host);
- if (check)
+ if (glines.size())
{
- WriteOpers("*** User %s matches G-Line: %s",u->second->nick,check);
- snprintf(reason,MAXBUF,"G-Lined: %s",check);
- kill_link(u->second,reason);
- go_again = true;
- break;
+ char* check = matches_gline(host);
+ if (check)
+ {
+ WriteOpers("*** User %s matches G-Line: %s",u->second->nick,check);
+ snprintf(reason,MAXBUF,"G-Lined: %s",check);
+ kill_link(u->second,reason);
+ go_again = true;
+ break;
+ }
}
- }
- }
-
- for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++)
- {
- if (!strcasecmp(u->second->server,ServerName))
- {
- snprintf(host,MAXBUF,"%s@%s",u->second->ident,u->second->host);
- char* check = matches_kline(host);
- if (check)
+ if (klines.size())
{
- WriteOpers("*** User %s matches K-Line: %s",u->second->nick,check);
- snprintf(reason,MAXBUF,"K-Lined: %s",check);
- kill_link(u->second,reason);
- go_again = true;
- break;
+ char* check = matches_kline(host);
+ if (check)
+ {
+ WriteOpers("*** User %s matches K-Line: %s",u->second->nick,check);
+ snprintf(reason,MAXBUF,"K-Lined: %s",check);
+ kill_link(u->second,reason);
+ go_again = true;
+ break;
+ }
}
- }
- }
-
- for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++)
- {
- if (!strcasecmp(u->second->server,ServerName))
- {
- char* check = matches_qline(u->second->nick);
- if (check)
+ if (qlines.size())
{
- snprintf(reason,MAXBUF,"Matched Q-Lined nick: %s",check);
- WriteOpers("*** Q-Lined nickname %s from %s: %s",u->second->nick,u->second->host,check);
- WriteServ(u->second->fd,"432 %s %s :Invalid nickname: %s",u->second->nick,u->second->nick,check);
- kill_link(u->second,reason);
- go_again = true;
- break;
+ char* check = matches_qline(u->second->nick);
+ if (check)
+ {
+ snprintf(reason,MAXBUF,"Matched Q-Lined nick: %s",check);
+ WriteOpers("*** Q-Lined nickname %s from %s: %s",u->second->nick,u->second->host,check);
+ WriteServ(u->second->fd,"432 %s %s :Invalid nickname: %s",u->second->nick,u->second->nick,check);
+ kill_link(u->second,reason);
+ go_again = true;
+ break;
+ }
}
- }
- }
-
- for (user_hash::const_iterator u = clientlist.begin(); u != clientlist.end(); u++)
- {
- if (!strcasecmp(u->second->server,ServerName))
- {
- char* check = matches_zline(u->second->ip);
- if (check)
+ if (zlines.size())
{
- snprintf(reason,MAXBUF,"Z-Lined: %s",check);
- WriteOpers("*** User %s matches Z-Line: %s",u->second->nick,u->second->host,check);
- kill_link(u->second,reason);
- go_again = true;
- break;
+ char* check = matches_zline(u->second->ip);
+ if (check)
+ {
+ snprintf(reason,MAXBUF,"Z-Lined: %s",check);
+ WriteOpers("*** User %s matches Z-Line: %s",u->second->nick,u->second->host,check);
+ kill_link(u->second,reason);
+ go_again = true;
+ break;
+ }
}
}
}
-
}
}