From 67215adc97f70b86300833ce891b47ba8fadd92c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 18 Feb 2021 04:10:14 +0000 Subject: Fix the numeric sent when a U-lined alias target is not online. --- include/numerics.h | 1 + src/coremods/core_message.cpp | 5 ----- src/modules/m_alias.cpp | 5 +++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/numerics.h b/include/numerics.h index a34d9b1e1..98abf2bbe 100644 --- a/include/numerics.h +++ b/include/numerics.h @@ -113,6 +113,7 @@ enum ERR_CANNOTSENDTOCHAN = 404, ERR_TOOMANYCHANNELS = 405, ERR_WASNOSUCHNICK = 406, + ERR_NOSUCHSERVICE = 408, // From RFC 2812. ERR_NOTEXTTOSEND = 412, ERR_UNKNOWNCOMMAND = 421, ERR_NOMOTD = 422, diff --git a/src/coremods/core_message.cpp b/src/coremods/core_message.cpp index 26573c8bf..75abd6900 100644 --- a/src/coremods/core_message.cpp +++ b/src/coremods/core_message.cpp @@ -24,11 +24,6 @@ #include "inspircd.h" -enum -{ - // From RFC 2812. - ERR_NOSUCHSERVICE = 408 -}; class MessageDetailsImpl : public MessageDetails { diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index df7add05c..478bfb3d9 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -286,17 +286,18 @@ class ModuleAlias : public Module if (!a->RequiredNick.empty()) { + int numeric = a->ULineOnly ? ERR_NOSUCHSERVICE : ERR_NOSUCHNICK; User* u = ServerInstance->FindNickOnly(a->RequiredNick); if (!u) { - user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is currently unavailable. Please try again later."); + user->WriteNumeric(numeric, a->RequiredNick, "is currently unavailable. Please try again later."); return 1; } if ((a->ULineOnly) && (!u->server->IsULine())) { ServerInstance->SNO->WriteToSnoMask('a', "NOTICE -- Service "+a->RequiredNick+" required by alias "+a->AliasedCommand+" is not on a U-lined server, possibly underhanded antics detected!"); - user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is not a network service! Please inform a server operator as soon as possible."); + user->WriteNumeric(numeric, a->RequiredNick, "is not a network service! Please inform a server operator as soon as possible."); return 1; } } -- cgit v1.2.3