diff options
-rw-r--r-- | include/configreader.h | 4 | ||||
-rw-r--r-- | src/cmd_kill.cpp | 32 | ||||
-rw-r--r-- | src/configreader.cpp | 3 |
3 files changed, 32 insertions, 7 deletions
diff --git a/include/configreader.h b/include/configreader.h index c4275ab5f..eefa359c9 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -422,6 +422,10 @@ class ServerConfig : public Extensible */ char HideWhoisServer[MAXBUF]; + /** Set to a non empty string to obfuscate nicknames prepended to a KILL. + */ + char HideKillsServer[MAXBUF]; + /** A list of IP addresses the server is listening * on. */ diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp index 49f05d6c2..00d584ddf 100644 --- a/src/cmd_kill.cpp +++ b/src/cmd_kill.cpp @@ -33,6 +33,7 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user) userrec *u = ServerInstance->FindNick(parameters[0]); char killreason[MAXBUF]; + char killoperreason[MAXBUF]; int MOD_RESULT = 0; if (u) @@ -42,26 +43,45 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user) if (MOD_RESULT) return CMD_FAILURE; + // generate two reasons here, one for users, one for opers. first, the user visible reason, which may change. + if (*ServerInstance->Config->HideKillsServer) + { + // hidekills is on, use it + snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1]); + } + else + { + // hidekills is off, do nothing + snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]); + } + + // opers are lucky ducks, they always see the real reason + snprintf(killoperreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]); + if (!IS_LOCAL(u)) { // remote kill ServerInstance->SNO->WriteToSnoMask('k',"Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]); - snprintf(killreason, MAXQUIT,"[%s] Killed (%s (%s))", ServerInstance->Config->ServerName, user->nick, parameters[1]); - u->WriteCommonExcept("QUIT :%s", killreason); FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason)); + /* + * IMPORTANT SHIT: + * There used to be a WriteCommonExcept() of the QUIT here. It seems to be unnecessary with QuitUser() right below, so it's gone. + * If it explodes painfully, put it back! + */ + userrec::QuitUser(ServerInstance, u, killreason); } else { // local kill + ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]); ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]); user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]); - ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]); - snprintf(killreason,MAXQUIT,"Killed (%s (%s))", user->nick, parameters[1]); - - userrec::QuitUser(ServerInstance, u, killreason); } + + // send the quit out + userrec::QuitUser(ServerInstance, u, killreason, killoperreason); } else { diff --git a/src/configreader.cpp b/src/configreader.cpp index 3ba691191..0b3b806e3 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -25,7 +25,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance) { this->ClearStack(); *ServerName = *Network = *ServerDesc = *AdminName = '\0'; - *HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = *FixedQuit = '\0'; + *HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = *FixedQuit = *HideKillsServer = '\0'; *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0'; *UserStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = *SuffixQuit = '\0'; WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0; @@ -604,6 +604,7 @@ void ServerConfig::Read(bool bail, userrec* user) {"options", "hidesplits", "0", new ValueContainerBool (&this->HideSplits), DT_BOOLEAN, NoValidation}, {"options", "hidebans", "0", new ValueContainerBool (&this->HideBans), DT_BOOLEAN, NoValidation}, {"options", "hidewhois", "", new ValueContainerChar (this->HideWhoisServer), DT_CHARPTR, NoValidation}, + {"options", "hidekills", "", new ValueContainerChar (this->HideKillsServer), DT_CHARPTR, NoValidation}, {"options", "operspywhois", "0", new ValueContainerBool (&this->OperSpyWhois), DT_BOOLEAN, NoValidation}, {"options", "nouserdns", "0", new ValueContainerBool (&this->NoUserDns), DT_BOOLEAN, NoValidation}, {"options", "syntaxhints", "0", new ValueContainerBool (&this->SyntaxHints), DT_BOOLEAN, NoValidation}, |