]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
m_permchannels Save channel TS, topic set time and set by information
[user/henk/code/inspircd.git] / src / users.cpp
index e55c7e0997346412daca37b43e35caddb6126f66..18a356ef8113f325d9de2dda03e958df2f6f1359 100644 (file)
@@ -88,12 +88,12 @@ std::string User::ProcessNoticeMasks(const char *sm)
                                                this->SetNoticeMask(*c, adding);
 
                                                output += *c;
+                                               oldadding = adding;
                                        }
                                }
                                else
                                        this->WriteNumeric(ERR_UNKNOWNSNOMASK, "%s %c :is unknown snomask char to me", this->nick.c_str(), *c);
 
-                               oldadding = adding;
                        break;
                }
 
@@ -455,6 +455,7 @@ void UserIOHandler::OnDataReady()
                ServerInstance->Users->QuitUser(user, "RecvQ exceeded");
                ServerInstance->SNO->WriteToSnoMask('a', "User %s RecvQ of %lu exceeds connect class maximum of %lu",
                        user->nick.c_str(), (unsigned long)recvq.length(), user->MyClass->GetRecvqMax());
+               return;
        }
        unsigned long sendqmax = ULONG_MAX;
        if (!user->HasPrivPermission("users/flood/increased-buffers"))
@@ -544,7 +545,12 @@ CullResult LocalUser::cull()
        // overwritten in UserManager::AddUser() with the real iterator so this check
        // is only a precaution currently.
        if (localuseriter != ServerInstance->Users->local_users.end())
+       {
+               ServerInstance->Users->local_count--;
                ServerInstance->Users->local_users.erase(localuseriter);
+       }
+       else
+               ServerInstance->Logs->Log("USERS", DEFAULT, "ERROR: LocalUserIter does not point to a valid entry for " + this->nick);
 
        ClearInvites();
        eh.cull();
@@ -839,6 +845,12 @@ void User::InvalidateCache()
 
 bool User::ChangeNick(const std::string& newnick, bool force)
 {
+       if (quitting)
+       {
+               ServerInstance->Logs->Log("USERS", DEFAULT, "ERROR: Attempted to change nick of a quitting user: " + this->nick);
+               return false;
+       }
+
        ModResult MOD_RESULT;
 
        if (force)
@@ -987,36 +999,39 @@ irc::sockets::cidr_mask User::GetCIDRMask()
        return irc::sockets::cidr_mask(client_sa, range);
 }
 
-bool User::SetClientIP(const char* sip)
+bool User::SetClientIP(const char* sip, bool recheck_eline)
 {
        cachedip.clear();
        cached_hostip.clear();
        return irc::sockets::aptosa(sip, 0, client_sa);
 }
 
-void User::SetClientIP(const irc::sockets::sockaddrs& sa)
+void User::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline)
 {
        cachedip.clear();
        cached_hostip.clear();
        memcpy(&client_sa, &sa, sizeof(irc::sockets::sockaddrs));
 }
 
-bool LocalUser::SetClientIP(const char* sip)
+bool LocalUser::SetClientIP(const char* sip, bool recheck_eline)
 {
        irc::sockets::sockaddrs sa;
        if (!irc::sockets::aptosa(sip, 0, sa))
                // Invalid
                return false;
 
-       LocalUser::SetClientIP(sa);
+       LocalUser::SetClientIP(sa, recheck_eline);
        return true;
 }
 
-void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa)
+void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_eline)
 {
        if (sa != client_sa)
        {
                User::SetClientIP(sa);
+               if (recheck_eline)
+                       this->exempt = (ServerInstance->XLines->MatchesLine("E", this) != NULL);
+
                FOREACH_MOD(I_OnSetUserIP,OnSetUserIP(this));
        }
 }
@@ -1483,7 +1498,7 @@ bool User::ChangeIdent(const char* newident)
 
        std::string quitstr = ":" + GetFullHost() + " QUIT :Changing ident";
 
-       this->ident.assign(newident, 0, ServerInstance->Config->Limits.IdentMax + 1);
+       this->ident.assign(newident, 0, ServerInstance->Config->Limits.IdentMax);
 
        this->InvalidateCache();