]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Finally apply my patch simplifying RSQUIT. Fixes bug #452, reported by Mark. This...
[user/henk/code/inspircd.git] / src / users.cpp
index 09b96ce6bf14eebd0de3f0d43b5ee3bd1b8c64b0..0dfe54f65d2ece1a7c43c2bfe6a1d8fac73493a1 100644 (file)
@@ -27,10 +27,11 @@ static unsigned long* already_sent = NULL;
 void InitializeAlreadySent(SocketEngine* SE)
 {
        already_sent = new unsigned long[SE->GetMaxFds()];
+       memset(already_sent, 0, sizeof(already_sent));
 }
 
 /* XXX: Used for speeding up WriteCommon operations */
-unsigned long uniq_id = 0;
+unsigned long uniq_id = 1;
 
 std::string User::ProcessNoticeMasks(const char *sm)
 {
@@ -988,46 +989,35 @@ void User::InvalidateCache()
 
 bool User::ForceNickChange(const char* newnick)
 {
-       /*
-        * 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;
+       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;
        }
-       else
+
+       std::deque<classbase*> dummy;
+       Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
+       if (nickhandler) // wtfbbq, when would this not be here
        {
-               std::deque<classbase*> dummy;
-               Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
-               if (nickhandler) // wtfbbq, when would this not be here
-               {
-                       nickhandler->HandleInternal(1, dummy);
-                       bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
-                       nickhandler->HandleInternal(0, dummy);
-                       return result;
-               }
+               nickhandler->HandleInternal(1, dummy);
+               bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
+               nickhandler->HandleInternal(0, dummy);
+               return result;
        }
 
-       // Unreachable.
+       // Unreachable, we hope
        return false;
 }