]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Convert uncontroversial anonymous numerics to use constants.
authorPeter Powell <petpow@saberuk.com>
Tue, 5 Sep 2017 16:54:40 +0000 (17:54 +0100)
committerPeter Powell <petpow@saberuk.com>
Wed, 6 Sep 2017 09:44:41 +0000 (10:44 +0100)
include/numerics.h
src/modules/m_globalload.cpp
src/modules/m_lockserv.cpp
src/modules/m_mlock.cpp
src/modules/m_nicklock.cpp
src/modules/m_opermotd.cpp
src/modules/m_sasl.cpp
src/modules/m_setidle.cpp
src/modules/m_sslmodes.cpp
src/modules/m_topiclock.cpp

index 03c1a1c96481f446bee8d191779e00a3879c91af..a105b970e1fd19e5850e17b51f7d7f0732b98e24 100644 (file)
@@ -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
 
index b71f29fcccef6527c2fdc50b27ec5bfdbec867c0..36a90bf55589cc3d4ddb668f80be35277e31c2d9 100644 (file)
@@ -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
                                {
index 7c1bb5bd35c902639907aa9f41a8ee4533115b15..068573e0dccc2cedbca3f3728199cbbaeb1674d8 100644 (file)
  * 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;
        }
index 2a0410bedcacd3e6fc84da2048f379caa7508d1e..85787ae9644b2e6c2c21983141c9a8fb3ceea46c 100644 (file)
 
 #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;
                }
 
index 6e22a69bbb7cd559550701ddcbc5ac92685b22d9..fae9d36d81d4b5990e95907897c0ef1cc019a35e 100644 (file)
 
 #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;
                        }
                }
index f6cb5853cff984e1f3d24cd164e3d042009a72c2..2431853c25e922928bcf283ead0aa93e5eba672b 100644 (file)
@@ -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");
        }
 };
 
index a2a721c2ab9f08756d168b683cf7ee2e427f32f7..9272efe0ecf435c58cc2ade966d38e22797259ad 100644 (file)
 #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;
index 4a15fd0d5a050fff9c33f6694ae94d7909aba858..6302b36544fd1d1a10bd3d2f61557f0fec436d6a 100644 (file)
 
 #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;
        }
index e499082ff81f5c821745597ca25744ec5961f573..d3afd00e6854ca4fac1adaf74736889904929ab9 100644 (file)
 #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;
                        }
                }
index 340fbfdec86655a96f9983015d586041032583f0..8a0712c3e9a444e65e79e3aa56e235b12efe7332 100644 (file)
 
 #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;
                }