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
This commit is contained in:
brain 2004-04-26 13:57:39 +00:00
parent 93784202ea
commit 32c49435b2
2 changed files with 65 additions and 73 deletions

View File

@ -1,5 +1,5 @@
[Editors]
Focused=43
Focused=46
Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0
[Editor_0]
@ -14,8 +14,8 @@ LeftChar=1
Open=1
Top=0
CursorCol=1
CursorRow=2159
TopLine=2134
CursorRow=1
TopLine=1
LeftChar=1
[Editor_2]
@ -295,9 +295,9 @@ LeftChar=1
[Editor_38]
Open=1
Top=0
CursorCol=1
CursorRow=1
TopLine=1
CursorCol=30
CursorRow=57
TopLine=10
LeftChar=1
[Editor_39]
Open=1
@ -329,11 +329,11 @@ TopLine=618
LeftChar=1
[Editor_43]
Open=1
Top=1
CursorCol=75
CursorRow=787
TopLine=760
LeftChar=39
Top=0
CursorCol=14
CursorRow=1447
TopLine=1420
LeftChar=1
[Editor_44]
Open=1
Top=0
@ -350,8 +350,8 @@ TopLine=77
LeftChar=1
[Editor_46]
Open=1
Top=0
CursorCol=1
CursorRow=605
TopLine=563
Top=1
CursorCol=2
CursorRow=591
TopLine=548
LeftChar=1

View File

@ -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;
}
}
if (klines.size())
{
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;
}
}
if (qlines.size())
{
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;
}
}
if (zlines.size())
{
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;
}
}
}
}
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)
{
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)
{
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)
{
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;
}
}
}
}
}