diff options
author | Matt Schatz <genius3000@g3k.solutions> | 2019-01-24 09:01:56 -0700 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-01-24 16:01:56 +0000 |
commit | d5b50d9ed107d6a8b9241a831c1dae713963b524 (patch) | |
tree | 37371ed3c1ca1234e7e75361800f6285f9abb1bc /src | |
parent | 2f35b78fbaadb8d9a6c47ffc198bd97f91af3306 (diff) |
Add the reason to xline removal notices. (#1545)
Show the reason in manual xline removal SNOTICEs, just like
expiry SNOTICEs do.
This modifies XLineManager::DelLine() to require another string
reference passed to it.
Requested by @Robby-.
Diffstat (limited to 'src')
-rw-r--r-- | src/coremods/core_xline/cmd_eline.cpp | 6 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_gline.cpp | 6 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_kline.cpp | 6 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_qline.cpp | 6 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_zline.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_cban.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_rline.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_shun.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_spanningtree/delline.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_svshold.cpp | 6 | ||||
-rw-r--r-- | src/xline.cpp | 4 |
11 files changed, 45 insertions, 24 deletions
diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp index 3010e0f61..4700e9fd2 100644 --- a/src/coremods/core_xline/cmd_eline.cpp +++ b/src/coremods/core_xline/cmd_eline.cpp @@ -87,9 +87,11 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters) } else { - if (ServerInstance->XLines->DelLine(target.c_str(), "E", user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(target.c_str(), "E", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed E-line on %s",user->nick.c_str(),target.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed E-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); } else { diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp index 60dcd714a..413da97b1 100644 --- a/src/coremods/core_xline/cmd_gline.cpp +++ b/src/coremods/core_xline/cmd_gline.cpp @@ -96,9 +96,11 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters) } else { - if (ServerInstance->XLines->DelLine(target.c_str(),"G",user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(target.c_str(), "G", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed G-line on %s",user->nick.c_str(),target.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed G-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); } else { diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp index 813b9afa6..6499b6b00 100644 --- a/src/coremods/core_xline/cmd_kline.cpp +++ b/src/coremods/core_xline/cmd_kline.cpp @@ -95,9 +95,11 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters) } else { - if (ServerInstance->XLines->DelLine(target.c_str(),"K",user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(target.c_str(), "K", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed K-line on %s",user->nick.c_str(),target.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed K-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); } else { diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp index 086d860fc..0b2ef99bb 100644 --- a/src/coremods/core_xline/cmd_qline.cpp +++ b/src/coremods/core_xline/cmd_qline.cpp @@ -74,9 +74,11 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters) } else { - if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "Q", user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "Q", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed Q-line on %s",user->nick.c_str(),parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed Q-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); } else { diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp index 31030adce..4aaa3061f 100644 --- a/src/coremods/core_xline/cmd_zline.cpp +++ b/src/coremods/core_xline/cmd_zline.cpp @@ -92,9 +92,11 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters) } else { - if (ServerInstance->XLines->DelLine(target.c_str(),"Z",user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(target.c_str(), "Z", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed Z-line on %s",user->nick.c_str(),target.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed Z-line on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); } else { diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 3cdbbbdfb..8d08de9d9 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -98,9 +98,11 @@ class CommandCBan : public Command if (parameters.size() == 1) { - if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "CBAN", user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "CBAN", reason, user)) { - ServerInstance->SNO->WriteGlobalSno('x', "%s removed CBan on %s.",user->nick.c_str(),parameters[0].c_str()); + ServerInstance->SNO->WriteGlobalSno('x', "%s removed CBan on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); } else { diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 1247e81d3..1eb2d8ac3 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -190,9 +190,11 @@ class CommandRLine : public Command } else { - if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed R-line on %s",user->nick.c_str(),parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed R-line on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); } else { diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 6453ace81..cd2743ab0 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -69,13 +69,15 @@ class CommandShun : public Command if (parameters.size() == 1) { - if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SHUN", user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SHUN", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x', "%s removed SHUN on %s", user->nick.c_str(), parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed SHUN on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); } - else if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", user)) + else if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", reason, user)) { - ServerInstance->SNO->WriteToSnoMask('x',"%s removed SHUN on %s", user->nick.c_str(), target.c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed SHUN on %s: %s", user->nick.c_str(), target.c_str(), reason.c_str()); } else { diff --git a/src/modules/m_spanningtree/delline.cpp b/src/modules/m_spanningtree/delline.cpp index c64bec654..e376147fd 100644 --- a/src/modules/m_spanningtree/delline.cpp +++ b/src/modules/m_spanningtree/delline.cpp @@ -25,12 +25,13 @@ CmdResult CommandDelLine::Handle(User* user, Params& params) { const std::string& setter = user->nick; + std::string reason; // XLineManager::DelLine() returns true if the xline existed, false if it didn't - if (ServerInstance->XLines->DelLine(params[1].c_str(), params[0], user)) + if (ServerInstance->XLines->DelLine(params[1].c_str(), params[0], reason, user)) { - ServerInstance->SNO->WriteToSnoMask('X',"%s removed %s%s on %s", setter.c_str(), - params[0].c_str(), params[0].length() == 1 ? "-line" : "", params[1].c_str()); + ServerInstance->SNO->WriteToSnoMask('X', "%s removed %s%s on %s: %s", setter.c_str(), + params[0].c_str(), params[0].length() == 1 ? "-line" : "", params[1].c_str(), reason.c_str()); return CMD_SUCCESS; } return CMD_FAILURE; diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index 0aaf113f0..73fde6582 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -112,10 +112,12 @@ class CommandSvshold : public Command if (parameters.size() == 1) { - if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SVSHOLD", user)) + std::string reason; + + if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SVSHOLD", reason, user)) { if (!silent) - ServerInstance->SNO->WriteToSnoMask('x',"%s removed SVSHOLD on %s",user->nick.c_str(),parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('x', "%s removed SVSHOLD on %s: %s", user->nick.c_str(), parameters[0].c_str(), reason.c_str()); } else { diff --git a/src/xline.cpp b/src/xline.cpp index 55496b424..ccdc58dc2 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -294,7 +294,7 @@ bool XLineManager::AddLine(XLine* line, User* user) // deletes a line, returns true if the line existed and was removed -bool XLineManager::DelLine(const char* hostmask, const std::string &type, User* user, bool simulate) +bool XLineManager::DelLine(const char* hostmask, const std::string& type, std::string& reason, User* user, bool simulate) { ContainerIter x = lookup_lines.find(type); @@ -306,6 +306,8 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User* if (y == x->second.end()) return false; + reason.assign(y->second->reason); + if (simulate) return true; |