]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Slight speed improvement in WHOing invisible users, insignificant
[user/henk/code/inspircd.git] / src / users.cpp
index 7847d82811dbaf21556536b7be4bb70420347096..be51cc46a518aed9bd66a77934854d889cb5139a 100644 (file)
@@ -884,25 +884,33 @@ bool User::ForceNickChange(const char* newnick)
 {
        try
        {
-               int MOD_RESULT = 0;
+               /*
+                * XXX this makes no sense..
+                * why do we do nothing for change on users not REG_ALL?
+                * why do we trigger events twice for everyone previously (and just them now)
+                * i think the first if () needs removing totally, or? -- w00t
+                */
+               if (this->registered != REG_ALL)
+               {
+                       int MOD_RESULT = 0;
 
-               this->InvalidateCache();
+                       this->InvalidateCache();
 
-               FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
+                       FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(this, newnick));
 
-               if (MOD_RESULT)
-               {
-                       ServerInstance->stats->statsCollisions++;
-                       return false;
-               }
+                       if (MOD_RESULT)
+                       {
+                               ServerInstance->stats->statsCollisions++;
+                               return false;
+                       }
 
-               if (ServerInstance->XLines->MatchesLine("Q",newnick))
-               {
-                       ServerInstance->stats->statsCollisions++;
-                       return false;
+                       if (ServerInstance->XLines->MatchesLine("Q",newnick))
+                       {
+                               ServerInstance->stats->statsCollisions++;
+                               return false;
+                       }
                }
-
-               if (this->registered == REG_ALL)
+               else
                {
                        std::deque<classbase*> dummy;
                        Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
@@ -1436,7 +1444,7 @@ bool User::ChangeIdent(const char* newident)
        if (this->ServerInstance->Config->CycleHosts)
                this->WriteCommonExcept("%s","QUIT :Changing ident");
 
-       strlcpy(this->ident, newident, IDENTMAX+2);
+       strlcpy(this->ident, newident, IDENTMAX+1);
 
        this->InvalidateCache();