summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-09-05 17:54:40 +0100
committerPeter Powell <petpow@saberuk.com>2017-09-06 10:44:41 +0100
commitb13b1b8a0613e48013ca9f6a5279559d0aee0f73 (patch)
tree963c043afff8d92edfd774f034b2fb0b9f1e2517
parentd68c5be901d1d3f3a68e9796f9cd0815a4568a72 (diff)
Convert uncontroversial anonymous numerics to use constants.
-rw-r--r--include/numerics.h2
-rw-r--r--src/modules/m_globalload.cpp2
-rw-r--r--src/modules/m_lockserv.cpp10
-rw-r--r--src/modules/m_mlock.cpp8
-rw-r--r--src/modules/m_nicklock.cpp14
-rw-r--r--src/modules/m_opermotd.cpp6
-rw-r--r--src/modules/m_sasl.cpp17
-rw-r--r--src/modules/m_setidle.cpp11
-rw-r--r--src/modules/m_sslmodes.cpp8
-rw-r--r--src/modules/m_topiclock.cpp8
10 files changed, 66 insertions, 20 deletions
diff --git a/include/numerics.h b/include/numerics.h
index 03c1a1c96..a105b970e 100644
--- a/include/numerics.h
+++ b/include/numerics.h
@@ -53,8 +53,6 @@ enum
RPL_ENDMAP = 17, // ircu
RPL_MAPUSERS = 18, // insp-specific
- RPL_YOURUUID = 42, // taken from ircnet
-
RPL_UMODEIS = 221,
RPL_RULES = 232, // unrealircd
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index b71f29fcc..36a90bf55 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -93,7 +93,7 @@ class CommandGunloadmodule : public Command
if (ServerInstance->Modules->Unload(m))
{
ServerInstance->SNO->WriteToSnoMask('a', "MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0].c_str(), user->nick.c_str());
- user->WriteRemoteNumeric(973, parameters[0], "Module successfully unloaded.");
+ user->WriteRemoteNumeric(RPL_UNLOADEDMODULE, parameters[0], "Module successfully unloaded.");
}
else
{
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index 7c1bb5bd3..068573e0d 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -24,6 +24,12 @@
* 988 <nick> <servername> :Closed for new connections
* 989 <nick> <servername> :Open for new connections
*/
+enum
+{
+ // InspIRCd-specific.
+ RPL_SERVLOCKON = 988,
+ RPL_SERVLOCKOFF = 989
+};
class CommandLockserv : public Command
{
@@ -45,7 +51,7 @@ class CommandLockserv : public Command
}
locked = parameters.empty() ? "Server is temporarily closed. Please try again later." : parameters[0];
- user->WriteNumeric(988, user->server->GetName(), "Closed for new connections");
+ user->WriteNumeric(RPL_SERVLOCKON, user->server->GetName(), "Closed for new connections");
ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily disallow new connections", user->nick.c_str());
return CMD_SUCCESS;
}
@@ -70,7 +76,7 @@ class CommandUnlockserv : public Command
}
locked.clear();
- user->WriteNumeric(989, user->server->GetName(), "Open for new connections");
+ user->WriteNumeric(RPL_SERVLOCKOFF, user->server->GetName(), "Open for new connections");
ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow new connections", user->nick.c_str());
return CMD_SUCCESS;
}
diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp
index 2a0410bed..85787ae96 100644
--- a/src/modules/m_mlock.cpp
+++ b/src/modules/m_mlock.cpp
@@ -19,6 +19,12 @@
#include "inspircd.h"
+enum
+{
+ // From Charybdis.
+ ERR_MLOCKRESTRICTED = 742
+};
+
class ModuleMLock : public Module
{
StringExtItem mlock;
@@ -50,7 +56,7 @@ class ModuleMLock : public Module
std::string::size_type p = mlock_str->find(mode);
if (p != std::string::npos)
{
- source->WriteNumeric(742, channel->name, mode, *mlock_str, "MODE cannot be set due to channel having an active MLOCK restriction policy");
+ source->WriteNumeric(ERR_MLOCKRESTRICTED, channel->name, mode, *mlock_str, "MODE cannot be set due to channel having an active MLOCK restriction policy");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index 6e22a69bb..fae9d36d8 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -22,6 +22,14 @@
#include "inspircd.h"
+enum
+{
+ // InspIRCd-specific.
+ ERR_NICKNOTLOCKED = 946,
+ RPL_NICKLOCKON = 947,
+ RPL_NICKLOCKOFF = 945
+};
+
/** Handle /NICKLOCK
*/
class CommandNicklock : public Command
@@ -55,7 +63,7 @@ class CommandNicklock : public Command
return CMD_FAILURE;
}
- user->WriteNumeric(947, parameters[1], "Nickname now locked.");
+ user->WriteNumeric(RPL_NICKLOCKON, parameters[1], "Nickname now locked.");
}
/* If we made it this far, extend the user */
@@ -111,11 +119,11 @@ class CommandNickunlock : public Command
if (locked.set(target, 0))
{
ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used NICKUNLOCK on "+target->nick);
- user->WriteRemoteNumeric(945, target->nick, "Nickname now unlocked.");
+ user->WriteRemoteNumeric(RPL_NICKLOCKOFF, target->nick, "Nickname now unlocked.");
}
else
{
- user->WriteRemoteNumeric(946, target->nick, "This user's nickname is not locked.");
+ user->WriteRemoteNumeric(ERR_NICKNOTLOCKED, target->nick, "This user's nickname is not locked.");
return CMD_FAILURE;
}
}
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index f6cb5853c..2431853c2 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -56,14 +56,14 @@ class CommandOpermotd : public Command
return;
}
- user->WriteRemoteNumeric(375, "- IRC Operators Message of the Day");
+ user->WriteRemoteNumeric(RPL_MOTDSTART, "- IRC Operators Message of the Day");
for (file_cache::const_iterator i = opermotd.begin(); i != opermotd.end(); ++i)
{
- user->WriteRemoteNumeric(372, InspIRCd::Format("- %s", i->c_str()));
+ user->WriteRemoteNumeric(RPL_MOTD, InspIRCd::Format("- %s", i->c_str()));
}
- user->WriteRemoteNumeric(376, "- End of OPERMOTD");
+ user->WriteRemoteNumeric(RPL_ENDOFMOTD, "- End of OPERMOTD");
}
};
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index a2a721c2a..9272efe0e 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -25,6 +25,15 @@
#include "modules/ssl.h"
#include "modules/spanningtree.h"
+enum
+{
+ // From IRCv3 sasl-3.1
+ RPL_SASLSUCCESS = 903,
+ ERR_SASLFAIL = 904,
+ ERR_SASLABORTED = 906,
+ RPL_SASLMECHS = 908
+};
+
static std::string sasl_target;
class ServerTracker : public SpanningTreeEventListener
@@ -263,7 +272,7 @@ class SaslAuthenticator
this->result = this->GetSaslResult(msg[3]);
}
else if (msg[2] == "M")
- this->user->WriteNumeric(908, msg[3], "are available SASL mechanisms");
+ this->user->WriteNumeric(RPL_SASLMECHS, msg[3], "are available SASL mechanisms");
else
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
@@ -315,13 +324,13 @@ class SaslAuthenticator
switch (this->result)
{
case SASL_OK:
- this->user->WriteNumeric(903, "SASL authentication successful");
+ this->user->WriteNumeric(RPL_SASLSUCCESS, "SASL authentication successful");
break;
case SASL_ABORT:
- this->user->WriteNumeric(906, "SASL authentication aborted");
+ this->user->WriteNumeric(ERR_SASLABORTED, "SASL authentication aborted");
break;
case SASL_FAIL:
- this->user->WriteNumeric(904, "SASL authentication failed");
+ this->user->WriteNumeric(ERR_SASLFAIL, "SASL authentication failed");
break;
default:
break;
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index 4a15fd0d5..6302b3654 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -21,6 +21,13 @@
#include "inspircd.h"
+enum
+{
+ // InspIRCd-specific.
+ ERR_INVALIDIDLETIME = 948,
+ RPL_IDLETIMESET = 944
+};
+
/** Handle /SETIDLE
*/
class CommandSetidle : public SplitCommand
@@ -36,7 +43,7 @@ class CommandSetidle : public SplitCommand
int idle = InspIRCd::Duration(parameters[0]);
if (idle < 1)
{
- user->WriteNumeric(948, "Invalid idle time.");
+ user->WriteNumeric(ERR_INVALIDIDLETIME, "Invalid idle time.");
return CMD_FAILURE;
}
user->idle_lastmsg = (ServerInstance->Time() - idle);
@@ -44,7 +51,7 @@ class CommandSetidle : public SplitCommand
if (user->signon > user->idle_lastmsg)
user->signon = user->idle_lastmsg;
ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds");
- user->WriteNumeric(944, "Idle time set.");
+ user->WriteNumeric(RPL_IDLETIMESET, "Idle time set.");
return CMD_SUCCESS;
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index e499082ff..d3afd00e6 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -24,6 +24,12 @@
#include "inspircd.h"
#include "modules/ssl.h"
+enum
+{
+ // From UnrealIRCd.
+ ERR_SECUREONLYCHAN = 489
+};
+
/** Handle channel mode +z
*/
class SSLMode : public ModeHandler
@@ -107,7 +113,7 @@ class ModuleSSLModes : public Module
else
{
// Deny
- user->WriteNumeric(489, cname, "Cannot join channel; SSL users only (+z)");
+ user->WriteNumeric(ERR_SECUREONLYCHAN, cname, "Cannot join channel; SSL users only (+z)");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp
index 340fbfdec..8a0712c3e 100644
--- a/src/modules/m_topiclock.cpp
+++ b/src/modules/m_topiclock.cpp
@@ -18,6 +18,12 @@
#include "inspircd.h"
+enum
+{
+ // InspIRCd-specific.
+ ERR_TOPICLOCK = 744
+};
+
class CommandSVSTOPIC : public Command
{
public:
@@ -131,7 +137,7 @@ class ModuleTopicLock : public Module
// Only fired for local users currently, but added a check anyway
if ((IS_LOCAL(user)) && (topiclock.get(chan)))
{
- user->WriteNumeric(744, chan->name, "TOPIC cannot be changed due to topic lock being active on the channel");
+ user->WriteNumeric(ERR_TOPICLOCK, chan->name, "TOPIC cannot be changed due to topic lock being active on the channel");
return MOD_RES_DENY;
}