X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fusermanager.cpp;h=1966c9b4729f86193e8c8fa87694a3bf9395c936;hb=8c71a2a6304f0d77aa7738e04a44f366a158cadd;hp=52cb4989fbbaf199ff0eee1aa1718d27337e4aae;hpb=3a3ff949670c61a4a8856e1391222e156eb1cd17;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 52cb4989f..1966c9b47 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -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) { @@ -112,7 +136,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs /* 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; } @@ -180,7 +204,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std: if (user->registered == REG_ALL) { FOREACH_MOD(OnUserQuit, (user, reason, *operreason)); - user->WriteCommonQuit(reason, *operreason); + WriteCommonQuit(user, reason, *operreason); } else unregistered_count--;