]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Only output the 'AES on' message if the socket state isnt I_ERROR when its reached
[user/henk/code/inspircd.git] / src / users.cpp
index f8b8efeb0589a00f2fe3aeb30dab38d5ce85a201..c15a3331b147d56c839340f7f110accb15f60d55 100644 (file)
@@ -973,14 +973,14 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
                userrec::QuitUser(Instance, _new,"Server is full");
                return;
        }
-       char* e = Instance->XLines->matches_exception(ipaddr);
+       ELine* e = Instance->XLines->matches_exception(_new);
        if (!e)
        {
-               char* r = Instance->XLines->matches_zline(ipaddr);
+               ZLine* r = Instance->XLines->matches_zline(ipaddr);
                if (r)
                {
                        char reason[MAXBUF];
-                       snprintf(reason,MAXBUF,"Z-Lined: %s",r);
+                       snprintf(reason,MAXBUF,"Z-Lined: %s",r->reason);
                        userrec::QuitUser(Instance, _new,reason);
                        return;
                }
@@ -1000,17 +1000,21 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
 
 long userrec::GlobalCloneCount()
 {
-       char u1[1024];
-       char u2[1024];
+       char u1[128] = {0};
+       char u2[128] = {0};
        long x = 0;
+       
+       this->GetIPString(u2);
+       
        for (user_hash::const_iterator a = ServerInstance->clientlist.begin(); a != ServerInstance->clientlist.end(); a++)
        {
                /* We have to match ip's as strings - we don't know what protocol
                 * a remote user may be using
                 */
-               if (!strcasecmp(a->second->GetIPString(u1), this->GetIPString(u2)))
-                               x++;
+               if (strcmp(a->second->GetIPString(u1), u2) == 0)
+                       x++;
        }
+       
        return x;
 }
 
@@ -1068,28 +1072,26 @@ void userrec::FullConnect(CullList* Goners)
                return;
        }
 
-       char match_against[MAXBUF];
-       snprintf(match_against,MAXBUF,"%s@%s", this->ident, this->host);
-       char* e = ServerInstance->XLines->matches_exception(match_against);
+       ELine* e = ServerInstance->XLines->matches_exception(this);
 
        if (!e)
        {
-               char* r = ServerInstance->XLines->matches_gline(match_against);
+               GLine* r = ServerInstance->XLines->matches_gline(this);
                
                if (r)
                {
                        char reason[MAXBUF];
-                       snprintf(reason,MAXBUF,"G-Lined: %s",r);
+                       snprintf(reason,MAXBUF,"G-Lined: %s",r->reason);
                        Goners->AddItem(this, reason);
                        return;
                }
                
-               r = ServerInstance->XLines->matches_kline(match_against);
+               KLine* n = ServerInstance->XLines->matches_kline(this);
                
-               if (r)
+               if (n)
                {
                        char reason[MAXBUF];
-                       snprintf(reason,MAXBUF,"K-Lined: %s",r);
+                       snprintf(reason,MAXBUF,"K-Lined: %s",n->reason);
                        Goners->AddItem(this, reason);
                        return;
                }
@@ -1717,6 +1719,9 @@ void userrec::ModChannelCount(int n)
 
 bool userrec::ChangeName(const char* gecos)
 {
+       if (!strcmp(gecos, this->fullname))
+               return true;
+
        if (IS_LOCAL(this))
        {
                int MOD_RESULT = 0;
@@ -1731,6 +1736,9 @@ bool userrec::ChangeName(const char* gecos)
 
 bool userrec::ChangeDisplayedHost(const char* host)
 {
+       if (!strcmp(host, this->dhost))
+               return true;
+
        if (IS_LOCAL(this))
        {
                int MOD_RESULT = 0;
@@ -1750,10 +1758,10 @@ bool userrec::ChangeDisplayedHost(const char* host)
                {
                        if ((*i)->channel)
                        {
-                               (*i)->channel->WriteAllExceptSender(this, 0, "JOIN %s", (*i)->channel->name);
+                               (*i)->channel->WriteAllExceptSender(this, false, 0, "JOIN %s", (*i)->channel->name);
                                std::string n = this->ServerInstance->Modes->ModeString(this, (*i)->channel);
-                               if (n.length())
-                                       (*i)->channel->WriteChannelWithServ(this->ServerInstance->Config->ServerName, "MODE %s +%s", (*i)->channel->name, n.c_str());
+                               if (n.length() > 0)
+                                       (*i)->channel->WriteAllExceptSender(this, true, 0, "MODE %s +%s", (*i)->channel->name, n.c_str());
                        }
                }
        }
@@ -1766,6 +1774,9 @@ bool userrec::ChangeDisplayedHost(const char* host)
 
 bool userrec::ChangeIdent(const char* newident)
 {
+       if (!strcmp(newident, this->ident))
+               return true;
+
        if (this->ServerInstance->Config->CycleHosts)
                this->WriteCommonExcept("%s","QUIT :Changing ident");
 
@@ -1777,10 +1788,10 @@ bool userrec::ChangeIdent(const char* newident)
                {
                        if ((*i)->channel)
                        {
-                               (*i)->channel->WriteAllExceptSender(this, 0, "JOIN %s", (*i)->channel->name);
+                               (*i)->channel->WriteAllExceptSender(this, false, 0, "JOIN %s", (*i)->channel->name);
                                std::string n = this->ServerInstance->Modes->ModeString(this, (*i)->channel);
-                               if (n.length())
-                                       (*i)->channel->WriteChannelWithServ(this->ServerInstance->Config->ServerName, "MODE %s +%s", (*i)->channel->name, n.c_str());
+                               if (n.length() > 0)
+                                       (*i)->channel->WriteAllExceptSender(this, true, 0, "MODE %s +%s", (*i)->channel->name, n.c_str());
                        }
                }
        }