Merge pull request #1145 from Adam-/insp20+ulinekill

Don't show snotices for kills from ulined clients
This commit is contained in:
Attila Molnar 2016-02-29 12:37:49 +01:00
commit 168a4edd03
4 changed files with 17 additions and 5 deletions

View File

@ -695,6 +695,9 @@
# hidekills: If defined, replaces who set a /kill with a custom string. # hidekills: If defined, replaces who set a /kill with a custom string.
hidekills="" hidekills=""
# hideulinekills: Hide kills from clients of ulined servers from server notices.
hideulinekills="yes"
# hidesplits: If enabled, non-opers will not be able to see which # hidesplits: If enabled, non-opers will not be able to see which
# servers split in a netsplit, they will only be able to see that one # servers split in a netsplit, they will only be able to see that one
# occurred (If their client has netsplit detection). # occurred (If their client has netsplit detection).

View File

@ -438,6 +438,10 @@ class CoreExport ServerConfig
*/ */
std::string HideKillsServer; std::string HideKillsServer;
/** Set to hide kills from clients of ulined servers in snotices.
*/
bool HideULineKills;
/** The full pathname and filename of the PID /** The full pathname and filename of the PID
* file as defined in the configuration. * file as defined in the configuration.
*/ */

View File

@ -111,7 +111,8 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
if (!IS_LOCAL(u)) if (!IS_LOCAL(u))
{ {
// remote kill // remote kill
ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); if (!ServerInstance->Config->HideULineKills || !ServerInstance->ULine(user->server))
ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str());
FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason)); FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason));
} }
else else
@ -121,10 +122,13 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
* XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill * XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill
* snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t * snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
*/ */
if (IS_LOCAL(user)) if (!ServerInstance->Config->HideULineKills || !ServerInstance->ULine(user->server))
ServerInstance->SNO->WriteGlobalSno('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); {
else if (IS_LOCAL(user))
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); ServerInstance->SNO->WriteGlobalSno('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str());
else
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str());
}
ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str());
/* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
* hidekillsserver as source if possible * hidekillsserver as source if possible

View File

@ -531,6 +531,7 @@ void ServerConfig::Fill()
HideBans = security->getBool("hidebans"); HideBans = security->getBool("hidebans");
HideWhoisServer = security->getString("hidewhois"); HideWhoisServer = security->getString("hidewhois");
HideKillsServer = security->getString("hidekills"); HideKillsServer = security->getString("hidekills");
HideULineKills = security->getBool("hideulinekills");
RestrictBannedUsers = security->getBool("restrictbannedusers", true); RestrictBannedUsers = security->getBool("restrictbannedusers", true);
GenericOper = security->getBool("genericoper"); GenericOper = security->getBool("genericoper");
NoUserDns = ConfValue("performance")->getBool("nouserdns"); NoUserDns = ConfValue("performance")->getBool("nouserdns");