From bde0e7e84668df48afaffda7a52eddc0aca543d3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 19 Apr 2021 17:52:38 +0100 Subject: Improve the message sent when a mode does not exist. --- src/mode.cpp | 4 +++- src/modules/m_disable.cpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mode.cpp b/src/mode.cpp index 306d39c5d..3ce7ee10f 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -388,7 +388,9 @@ void ModeParser::ModeParamsToChangeList(User* user, ModeType type, const std::ve if (!mh) { /* No mode handler? Unknown mode character then. */ - user->WriteNumeric(type == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK, modechar, "is an unknown mode character"); + int numeric = (type == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK); + const char* typestr = (type == MODETYPE_CHANNEL ? "channel" : "user"); + user->WriteNumeric(numeric, modechar, InspIRCd::Format("is not a recognised %s mode.", typestr)); continue; } diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index 95fcd8b4c..6ba5243c9 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -171,8 +171,9 @@ class ModuleDisable : public Module { // The server administrator has specified that disabled modes should be // treated as if they do not exist. - user->WriteNumeric(mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK, - mh->GetModeChar(), "is an unknown mode character"); + int numeric = (mh->GetModeType() == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK); + const char* typestr = (mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user"); + user->WriteNumeric(numeric, mh->GetModeChar(), InspIRCd::Format("is not a recognised %s mode.", typestr)); return MOD_RES_DENY; } -- cgit v1.2.3