From: Attila Molnar Date: Thu, 5 Feb 2015 16:37:26 +0000 (+0100) Subject: Merge pull request #971 from SaberUK/master+numeric-xline X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=8c71a2a6304f0d77aa7738e04a44f366a158cadd;hp=-c;p=user%2Fhenk%2Fcode%2Finspircd.git Merge pull request #971 from SaberUK/master+numeric-xline Use ERR_YOUREBANNEDCREEP instead of NOTICE when a user is banned. --- 8c71a2a6304f0d77aa7738e04a44f366a158cadd diff --combined src/usermanager.cpp index 5d07c4d79,0efad66b4..1966c9b47 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@@ -24,30 -24,6 +24,30 @@@ #include "xline.h" #include "iohook.h" +namespace +{ + class WriteCommonQuit : public User::ForEachNeighborHandler + { + std::string line; + std::string operline; + + void Execute(LocalUser* user) CXX11_OVERRIDE + { + user->Write(user->IsOper() ? operline : line); + } + + public: + WriteCommonQuit(User* user, const std::string& msg, const std::string& opermsg) + : line(":" + user->GetFullHost() + " QUIT :") + , operline(line) + { + line += msg; + operline += opermsg; + user->ForEachNeighbor(*this, false); + } + }; +} + UserManager::UserManager() : unregistered_count(0) { @@@ -136,7 -112,7 +136,7 @@@ void UserManager::AddUser(int socket, L /* user banned */ ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Positive hit for " + New->GetIPString()); if (!ServerInstance->Config->XLineMessage.empty()) - New->WriteNotice("*** " + ServerInstance->Config->XLineMessage); + New->WriteNumeric(ERR_YOUREBANNEDCREEP, ":" + ServerInstance->Config->XLineMessage); this->QuitUser(New, b->Reason); return; } @@@ -204,7 -180,7 +204,7 @@@ void UserManager::QuitUser(User* user, if (user->registered == REG_ALL) { FOREACH_MOD(OnUserQuit, (user, reason, *operreason)); - user->WriteCommonQuit(reason, *operreason); + WriteCommonQuit(user, reason, *operreason); } else unregistered_count--;