diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-09 01:02:44 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-09 01:02:44 +0000 |
commit | cba3552f3a77f1c98dd2a718b4b5d9864267b48d (patch) | |
tree | 90c2dba2d08e82cb71aa9ad7e572d1152cdf3f3f /src | |
parent | a60f054438331ea7385d5fda27f01e77180fb677 (diff) |
Implement bug #282 from owine: kill sender hiding. <options:hidekills> needs to be set to a static string to display instead of the killer's nick. QA: *IMPORTANT* please extensivly test local ***AND*** remote killing with this on and off. Thanks :)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6921 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd_kill.cpp | 32 | ||||
-rw-r--r-- | src/configreader.cpp | 3 |
2 files changed, 28 insertions, 7 deletions
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}, |