]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/xline.cpp
Added m_alias module which provides command aliases.
[user/henk/code/inspircd.git] / src / xline.cpp
index d83967aa0d463a1d73540e6dedb1af733e0daf73..9e756abe58cbcfa53d9f985033562b98323ab5ba 100644 (file)
@@ -336,14 +336,14 @@ void sync_xlines(serverrec* serv, char* tcp_host)
        {
                if (i->is_global)
                {
-                       snprintf(data,MAXBUF,"{ %s %s %ld %ld :%s",i->ipaddr,i->source,i->set_time,i->duration,i->reason);
+                       snprintf(data,MAXBUF,"{ %s %s %ld %ld :%s",i->nick,i->source,i->set_time,i->duration,i->reason);
                        serv->SendPacket(data,tcp_host);
                }
        }
        // glines are always global, so no need to check
        for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
        {
-               snprintf(data,MAXBUF,"# %s %s %ld %ld :%s",i->ipaddr,i->source,i->set_time,i->duration,i->reason);
+               snprintf(data,MAXBUF,"# %s %s %ld %ld :%s",i->hostmask,i->source,i->set_time,i->duration,i->reason);
                serv->SendPacket(data,tcp_host);
        }
 }
@@ -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,67 +552,56 @@ 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);
+                                               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())
                                {
-                                       WriteOpers("*** User %s matches Z-Line: %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);
-                                       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;
+                                       }
                                }
                        }
                }
-
        }
 }