summaryrefslogtreecommitdiff
path: root/src/modules/m_opermotd.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-04-26 18:35:17 +0100
committerPeter Powell <petpow@saberuk.com>2019-04-26 18:35:17 +0100
commitece446b149e4b5692cee1430c169ca2a255244cd (patch)
treebe79714413296d6117abe3e97ab60d2cf02f4c7a /src/modules/m_opermotd.cpp
parentb4599531f97a9e6207b6bb8d728d7523b6995523 (diff)
Fix the numerics used by the opermotd module.
- Use ERR_NOOPERMOTD from UnrealIRCd and RPL_OMOTDSTART, RPL_OMOTD, and RPL_ENDOFOMOTD from ircd-ratbox. - Only send ERR_NOOPERMOTD in response to the command.
Diffstat (limited to 'src/modules/m_opermotd.cpp')
-rw-r--r--src/modules/m_opermotd.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index 591dc97a8..4635cd831 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -22,6 +22,17 @@
#include "inspircd.h"
+enum
+{
+ // From UnrealIRCd.
+ ERR_NOOPERMOTD = 425,
+
+ // From ircd-ratbox.
+ RPL_OMOTDSTART = 720,
+ RPL_OMOTD = 721,
+ RPL_ENDOFOMOTD = 722
+};
+
/** Handle /OPERMOTD
*/
class CommandOpermotd : public Command
@@ -37,7 +48,7 @@ class CommandOpermotd : public Command
CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
{
if ((parameters.empty()) || (irc::equals(parameters[0], ServerInstance->Config->ServerName)))
- ShowOperMOTD(user);
+ ShowOperMOTD(user, true);
return CMD_SUCCESS;
}
@@ -48,22 +59,22 @@ class CommandOpermotd : public Command
return ROUTE_LOCALONLY;
}
- void ShowOperMOTD(User* user)
+ void ShowOperMOTD(User* user, bool show_missing)
{
- if (opermotd.empty())
+ if (opermotd.empty() && show_missing)
{
- user->WriteRemoteNumeric(455, "OPERMOTD file is missing");
+ user->WriteRemoteNumeric(ERR_NOOPERMOTD, "OPERMOTD file is missing");
return;
}
- user->WriteRemoteNumeric(RPL_MOTDSTART, "- IRC Operators Message of the Day");
+ user->WriteRemoteNumeric(RPL_OMOTDSTART, "- IRC Operators Message of the Day");
for (file_cache::const_iterator i = opermotd.begin(); i != opermotd.end(); ++i)
{
- user->WriteRemoteNumeric(RPL_MOTD, InspIRCd::Format("- %s", i->c_str()));
+ user->WriteRemoteNumeric(RPL_OMOTD, InspIRCd::Format("- %s", i->c_str()));
}
- user->WriteRemoteNumeric(RPL_ENDOFMOTD, "- End of OPERMOTD");
+ user->WriteRemoteNumeric(RPL_ENDOFOMOTD, "- End of OPERMOTD");
}
};
@@ -87,7 +98,7 @@ class ModuleOpermotd : public Module
void OnOper(User* user, const std::string &opertype) CXX11_OVERRIDE
{
if (onoper && IS_LOCAL(user))
- cmd.ShowOperMOTD(user);
+ cmd.ShowOperMOTD(user, false);
}
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE