]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Remove needless chdir() from inspircd executable
[user/henk/code/inspircd.git] / src / users.cpp
index 647619ae81e7027ec7b6410b21491de712c2714f..7952c98ac7eb7dc8f3b0b2b006b0012f3d4ec907 100644 (file)
@@ -24,9 +24,6 @@ static unsigned long uniq_id = 1;
 
 static unsigned long* already_sent = NULL;
 
-LocalIntExt User::NICKForced("NICKForced", NULL);
-LocalStringExt User::OperQuit("OperQuit", NULL);
-
 void InitializeAlreadySent(SocketEngine* SE)
 {
        already_sent = new unsigned long[SE->GetMaxFds()];
@@ -914,9 +911,9 @@ bool User::ForceNickChange(const char* newnick)
 
        this->InvalidateCache();
 
-       NICKForced.set(this, 1);
+       ServerInstance->NICKForced.set(this, 1);
        FIRST_MOD_RESULT(OnUserPreNick, MOD_RESULT, (this, newnick));
-       NICKForced.set(this, 0);
+       ServerInstance->NICKForced.set(this, 0);
 
        if (MOD_RESULT == MOD_RES_DENY)
        {
@@ -930,9 +927,9 @@ bool User::ForceNickChange(const char* newnick)
        {
                std::vector<std::string> parameters;
                parameters.push_back(newnick);
-               NICKForced.set(this, 1);
+               ServerInstance->NICKForced.set(this, 1);
                bool result = (ServerInstance->Parser->CallHandler("NICK", parameters, this) == CMD_SUCCESS);
-               NICKForced.set(this, 0);
+               ServerInstance->NICKForced.set(this, 0);
                return result;
        }
 
@@ -1203,7 +1200,7 @@ void User::WriteCommon(const char* text, ...)
        char textbuffer[MAXBUF];
        va_list argsPtr;
 
-       if (this->registered != REG_ALL || !IS_LOCAL(this) || quitting)
+       if (this->registered != REG_ALL || quitting)
                return;
 
        int len = snprintf(textbuffer,MAXBUF,":%s ",this->GetFullHost().c_str());
@@ -1220,7 +1217,7 @@ void User::WriteCommonExcept(const char* text, ...)
        char textbuffer[MAXBUF];
        va_list argsPtr;
 
-       if (this->registered != REG_ALL || !IS_LOCAL(this) || quitting)
+       if (this->registered != REG_ALL || quitting)
                return;
 
        int len = snprintf(textbuffer,MAXBUF,":%s ",this->GetFullHost().c_str());
@@ -1234,7 +1231,7 @@ void User::WriteCommonExcept(const char* text, ...)
 
 void User::WriteCommonRaw(const std::string &line, bool include_self)
 {
-       if (this->registered != REG_ALL || !IS_LOCAL(this) || quitting)
+       if (this->registered != REG_ALL || quitting)
                return;
 
        if (!already_sent)
@@ -1404,7 +1401,8 @@ void User::DoHostCycle(const std::string &quitline)
        if (!ServerInstance->Config->CycleHosts)
                return;
 
-       uniq_id++;
+       unsigned int silent_id = ++uniq_id;
+       unsigned int seen_id = ++uniq_id;
 
        if (!already_sent)
                InitializeAlreadySent(ServerInstance->SE);
@@ -1419,9 +1417,15 @@ void User::DoHostCycle(const std::string &quitline)
                User* u = i->first;
                if (IS_LOCAL(u) && !u->quitting)
                {
-                       already_sent[u->fd] = uniq_id;
                        if (i->second)
+                       {
+                               already_sent[u->fd] = seen_id;
                                u->Write(quitline);
+                       }
+                       else
+                       {
+                               already_sent[u->fd] = silent_id;
+                       }
                }
        }
        for (UCListIter v = include_c.begin(); v != include_c.end(); ++v)
@@ -1442,11 +1446,13 @@ void User::DoHostCycle(const std::string &quitline)
                        User* u = i->first;
                        if (u == this || !IS_LOCAL(u))
                                continue;
+                       if (already_sent[u->fd] == silent_id)
+                               continue;
 
-                       if (already_sent[i->first->fd] != uniq_id)
+                       if (already_sent[u->fd] != seen_id)
                        {
                                u->Write(quitline);
-                               already_sent[i->first->fd] = uniq_id;
+                               already_sent[i->first->fd] = seen_id;
                        }
                        u->Write(joinline);
                        if (modeline.length() > 0)