From aabaca020b76c6d78b3ddb7c65e1b1d627f7276c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 4 Jul 2021 21:12:29 +0100 Subject: Stop sending RPL_WHOISSERVICE as it conflicts with RPL_WHOISHELPOP. Both Anope and Atheme send an oper type for services clients so this numeric is unnecessary. In cases where genericoper is enabled we now send "is a network service" in RPL_WHOISOPERATOR. --- src/modules/m_servprotect.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/modules/m_servprotect.cpp') diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 6a0474099..98b5983f6 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -27,9 +27,6 @@ enum { - // From AustHex. - RPL_WHOISSERVICE = 310, - // From UnrealIRCd. ERR_KILLDENY = 485 }; @@ -55,13 +52,14 @@ class ServProtectMode : public ModeHandler } }; -class ModuleServProtectMode : public Module, public Whois::EventListener, public Whois::LineEventListener +class ModuleServProtectMode CXX11_FINAL + : public Module + , public Whois::LineEventListener { ServProtectMode bm; public: ModuleServProtectMode() - : Whois::EventListener(this) - , Whois::LineEventListener(this) + : Whois::LineEventListener(this) , bm(this) { } @@ -71,14 +69,6 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public return Version("Adds user mode k (servprotect) which protects services pseudoclients from being kicked, being killed, or having their channel prefix modes changed.", VF_VENDOR); } - void OnWhois(Whois::Context& whois) CXX11_OVERRIDE - { - if (whois.GetTarget()->IsModeSet(bm)) - { - whois.SendLine(RPL_WHOISSERVICE, "is a Network Service on " + ServerInstance->Config->Network); - } - } - ModResult OnRawMode(User* user, Channel* chan, ModeHandler* mh, const std::string& param, bool adding) CXX11_OVERRIDE { /* Check that the mode is not a server mode, it is being removed, the user making the change is local, there is a parameter, -- cgit v1.3.1-10-gc9f91 From 38351efa8d3f17ad9a46f332783fbe0fd663f0cf Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 5 Jul 2021 16:43:33 +0100 Subject: Deduplicate all whois numerics to the whois module header. --- include/modules/whois.h | 21 ++++++++++++++++++--- include/numerics.h | 3 --- src/coremods/core_whowas.cpp | 1 + src/modules/m_botmode.cpp | 6 ------ src/modules/m_cgiirc.cpp | 6 ------ src/modules/m_customtitle.cpp | 8 +------- src/modules/m_geoban.cpp | 6 ------ src/modules/m_helpop.cpp | 3 --- src/modules/m_hideoper.cpp | 2 +- src/modules/m_services_account.cpp | 6 ------ src/modules/m_servprotect.cpp | 2 +- src/modules/m_spanningtree/override_whois.cpp | 1 + src/modules/m_sslinfo.cpp | 9 --------- src/modules/m_swhois.cpp | 8 -------- 14 files changed, 23 insertions(+), 59 deletions(-) (limited to 'src/modules/m_servprotect.cpp') diff --git a/include/modules/whois.h b/include/modules/whois.h index 0e8fbc84a..4368c65d5 100644 --- a/include/modules/whois.h +++ b/include/modules/whois.h @@ -31,18 +31,33 @@ namespace Whois enum { + // InspIRCd-specific. + RPL_WHOISCOUNTRY = 344, + RPL_WHOISGATEWAY = 350, + RPL_CHANNELSMSG = 651, + + // From ircu. + RPL_WHOISACCOUNT = 330, + + // From oftc-hybrid. + RPL_WHOISCERTFP = 276, + // From RFC 1459. RPL_WHOISUSER = 311, + RPL_WHOISSERVER = 312, RPL_WHOISOPERATOR = 313, RPL_WHOISIDLE = 317, + RPL_ENDOFWHOIS = 318, RPL_WHOISCHANNELS = 319, // From UnrealIRCd. + RPL_WHOISREGNICK = 307, + RPL_WHOISHELPOP = 310, + RPL_WHOISSPECIAL = 320, + RPL_WHOISBOT = 335, RPL_WHOISHOST = 378, RPL_WHOISMODES = 379, - - // InspIRCd-specific. - RPL_CHANNELSMSG = 651 + RPL_WHOISSECURE = 671 }; class Whois::EventListener : public Events::ModuleEventListener diff --git a/include/numerics.h b/include/numerics.h index 4d33a16b7..db2cd2e77 100644 --- a/include/numerics.h +++ b/include/numerics.h @@ -72,9 +72,6 @@ enum RPL_USERHOST = 302, RPL_ISON = 303, - RPL_WHOISSERVER = 312, - RPL_ENDOFWHOIS = 318, - RPL_LISTSTART = 321, RPL_LIST = 322, RPL_LISTEND = 323, diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index 02bcdf5d4..18fbd83d2 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -26,6 +26,7 @@ #include "inspircd.h" #include "modules/stats.h" +#include "modules/whois.h" enum { diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index a31d51d3d..1ef6663f9 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -28,12 +28,6 @@ #include "modules/who.h" #include "modules/whois.h" -enum -{ - // From UnrealIRCd. - RPL_WHOISBOT = 335 -}; - class BotTag : public ClientProtocol::MessageTagProvider { private: diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index f0963e4c1..37609bec0 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -33,12 +33,6 @@ #include "modules/webirc.h" #include "modules/whois.h" -enum -{ - // InspIRCd-specific. - RPL_WHOISGATEWAY = 350 -}; - // One or more hostmask globs or CIDR ranges. typedef std::vector MaskList; diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index faac3045a..fc6d57d80 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -27,12 +27,6 @@ #include "inspircd.h" #include "modules/whois.h" -enum -{ - // From UnrealIRCd. - RPL_WHOISSPECIAL = 320 -}; - struct CustomTitle { const std::string name; @@ -156,7 +150,7 @@ class ModuleCustomTitle : public Module, public Whois::LineEventListener ModResult OnWhoisLine(Whois::Context& whois, Numeric::Numeric& numeric) CXX11_OVERRIDE { /* We use this and not OnWhois because this triggers for remote, too */ - if (numeric.GetNumeric() == 312) + if (numeric.GetNumeric() == RPL_WHOISSERVER) { /* Insert our numeric before 312 */ const std::string* ctitle = cmd.ctitle.get(whois.GetTarget()); diff --git a/src/modules/m_geoban.cpp b/src/modules/m_geoban.cpp index 63f7de6ac..4b2b3ff87 100644 --- a/src/modules/m_geoban.cpp +++ b/src/modules/m_geoban.cpp @@ -22,12 +22,6 @@ #include "modules/geolocation.h" #include "modules/whois.h" -enum -{ - // InspIRCd-specific. - RPL_WHOISCOUNTRY = 344 -}; - class ModuleGeoBan : public Module , public Whois::EventListener diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index f1f26a5ee..594f4a8d4 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -29,9 +29,6 @@ enum { - // From UnrealIRCd. - RPL_WHOISHELPOP = 310, - // From ircd-ratbox. ERR_HELPNOTFOUND = 524, RPL_HELPSTART = 704, diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 888f9ad5f..cca0b4da4 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -110,7 +110,7 @@ class ModuleHideOper /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the * person doing the WHOIS is not an oper */ - if (numeric.GetNumeric() != 313) + if (numeric.GetNumeric() != RPL_WHOISOPERATOR) return MOD_RES_PASSTHRU; if (!whois.GetTarget()->IsModeSet(hm)) diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 44e121cfd..306f25ea9 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -35,12 +35,6 @@ enum { - // From UnrealIRCd. - RPL_WHOISREGNICK = 307, - - // From ircu. - RPL_WHOISACCOUNT = 330, - // From ircd-hybrid? ERR_NEEDREGGEDNICK = 477, diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 98b5983f6..ad7d924b4 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -129,7 +129,7 @@ class ModuleServProtectMode CXX11_FINAL ModResult OnWhoisLine(Whois::Context& whois, Numeric::Numeric& numeric) CXX11_OVERRIDE { - return ((numeric.GetNumeric() == 319) && whois.GetTarget()->IsModeSet(bm)) ? MOD_RES_DENY : MOD_RES_PASSTHRU; + return ((numeric.GetNumeric() == RPL_WHOISCHANNELS) && whois.GetTarget()->IsModeSet(bm)) ? MOD_RES_DENY : MOD_RES_PASSTHRU; } }; diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index 01246f22d..4547f9130 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -22,6 +22,7 @@ */ #include "inspircd.h" +#include "modules/whois.h" #include "main.h" #include "commandbuilder.h" diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 28ba3f177..6062bd473 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -31,15 +31,6 @@ #include "modules/whois.h" #include "modules/who.h" -enum -{ - // From oftc-hybrid. - RPL_WHOISCERTFP = 276, - - // From UnrealIRCd. - RPL_WHOISSECURE = 671 -}; - class SSLCertExt : public ExtensionItem { public: diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 691e0a3a8..da45769fd 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -27,14 +27,6 @@ #include "inspircd.h" #include "modules/whois.h" -enum -{ - // From UnrealIRCd. - RPL_WHOISSPECIAL = 320 -}; - -/** Handle /SWHOIS - */ class CommandSwhois : public Command { public: -- cgit v1.3.1-10-gc9f91