]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add names for a bunch of numerics.
authorPeter Powell <petpow@saberuk.com>
Sat, 27 Jan 2018 12:24:47 +0000 (12:24 +0000)
committerPeter Powell <petpow@saberuk.com>
Fri, 2 Feb 2018 10:43:32 +0000 (10:43 +0000)
include/numerics.h
src/modules/m_abbreviation.cpp
src/modules/m_chanfilter.cpp
src/modules/m_dccallow.cpp
src/modules/m_knock.cpp
src/modules/m_namedmodes.cpp
src/modules/m_servprotect.cpp
src/modules/m_silence.cpp
src/modules/m_sslinfo.cpp
src/modules/m_uninvite.cpp
src/modules/m_watch.cpp

index 740ee17973bf6e1f67d47bc526de7a6434003314..2a3f090e79545481b785a61bdc32d6c97938bfd1 100644 (file)
@@ -24,8 +24,6 @@
  * Module authors, please note!
  *  While you are free to use any numerics on this list, like the rest of the core, you
  *  *should not* be editing it!
- *  You should just WriteNumeric(444, .. or whatever as you would before this file, OR:
- *  #define RPL_MYNUMERIC 444 & WriteNumeric(RPL_MYNUMERIC, ...
  *
  *  If you *do* have a suggestion for a numeric you genuinely believe would be useful,
  *  please speak to us. :)
index 2a38bd3a674f16a57b2ae4f6a04f74d88731c10b..c81caf1429cc6b9f39d380d426f4ff96dc4a63fd 100644 (file)
 
 #include "inspircd.h"
 
+enum
+{
+       // InspIRCd-specific.
+       ERR_AMBIGUOUSCOMMAND = 420
+};
+
 class ModuleAbbreviation : public Module
 {
  public:
@@ -49,7 +55,7 @@ class ModuleAbbreviation : public Module
                        {
                                if (matchlist.length() > 450)
                                {
-                                       user->WriteNumeric(420, "Ambiguous abbreviation and too many possible matches.");
+                                       user->WriteNumeric(ERR_AMBIGUOUSCOMMAND, "Ambiguous abbreviation and too many possible matches.");
                                        return MOD_RES_DENY;
                                }
 
@@ -67,7 +73,7 @@ class ModuleAbbreviation : public Module
                /* Ambiguous command, list the matches */
                if (!matchlist.empty())
                {
-                       user->WriteNumeric(420, InspIRCd::Format("Ambiguous abbreviation, possible matches: %s%s", foundcommand.c_str(), matchlist.c_str()));
+                       user->WriteNumeric(ERR_AMBIGUOUSCOMMAND, InspIRCd::Format("Ambiguous abbreviation, possible matches: %s%s", foundcommand.c_str(), matchlist.c_str()));
                        return MOD_RES_DENY;
                }
 
index d201f5418b60bed6dcff04963f41b317a9136590..70535a475e05e089a08abf0a2a7718a54b7f17d6 100644 (file)
 #include "listmode.h"
 #include "modules/exemption.h"
 
+enum
+{
+       // InspIRCd-specific.
+       ERR_ALREADYCHANFILTERED = 937,
+       ERR_NOSUCHCHANFILTER = 938,
+       ERR_CHANFILTERFULL = 939
+};
+
 /** Handles channel mode +g
  */
 class ChanFilter : public ListModeBase
@@ -46,17 +54,17 @@ class ChanFilter : public ListModeBase
 
        void TellListTooLong(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
        {
-               user->WriteNumeric(939, chan->name, word, "Channel spamfilter list is full");
+               user->WriteNumeric(ERR_CHANFILTERFULL, chan->name, word, "Channel spamfilter list is full");
        }
 
        void TellAlreadyOnList(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
        {
-               user->WriteNumeric(937, chan->name, InspIRCd::Format("The word %s is already on the spamfilter list", word.c_str()));
+               user->WriteNumeric(ERR_ALREADYCHANFILTERED, chan->name, InspIRCd::Format("The word %s is already on the spamfilter list", word.c_str()));
        }
 
        void TellNotSet(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
        {
-               user->WriteNumeric(938, chan->name, "No such spamfilter word is set");
+               user->WriteNumeric(ERR_NOSUCHCHANFILTER, chan->name, "No such spamfilter word is set");
        }
 };
 
index 65eeeba11a9ac353ba5feacb99c45479ee2ad2d7..0e6188339e6e1753c2d4b46143f0fa429c156775 100644 (file)
 
 #include "inspircd.h"
 
+enum
+{
+       // InspIRCd-specific?
+       RPL_DCCALLOWSTART = 990,
+       RPL_DCCALLOWLIST = 991,
+       RPL_DCCALLOWEND = 992,
+       RPL_DCCALLOWTIMED = 993,
+       RPL_DCCALLOWPERMANENT = 994,
+       RPL_DCCALLOWREMOVED = 995,
+       ERR_DCCALLOWINVALID = 996,
+       RPL_DCCALLOWEXPIRED = 997,
+       ERR_UNKNOWNDCCALLOWCMD = 998,
+       // TODO: These numerics are conflicting and should be removed
+       // and be replaced with helpop.
+       RPL_DCCALLOWHELP = 998,
+       RPL_ENDOFDCCALLOWHELP = 999
+};
+
 static const char* const helptext[] =
 {
        "DCCALLOW [(+|-)<nick> [<time>]]|[LIST|HELP]",
@@ -126,7 +144,7 @@ class CommandDccallow : public Command
                                }
                                else
                                {
-                                       user->WriteNumeric(998, "DCCALLOW command not understood. For help on DCCALLOW, type /DCCALLOW HELP");
+                                       user->WriteNumeric(ERR_UNKNOWNDCCALLOWCMD, "DCCALLOW command not understood. For help on DCCALLOW, type /DCCALLOW HELP");
                                        return CMD_FAILURE;
                                }
                        }
@@ -149,7 +167,7 @@ class CommandDccallow : public Command
                                                        if (i->nickname == target->nick)
                                                        {
                                                                dl->erase(i);
-                                                               user->WriteNumeric(995, user->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", target->nick.c_str()));
+                                                               user->WriteNumeric(RPL_DCCALLOWREMOVED, user->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", target->nick.c_str()));
                                                                break;
                                                        }
                                                }
@@ -159,7 +177,7 @@ class CommandDccallow : public Command
                                {
                                        if (target == user)
                                        {
-                                               user->WriteNumeric(996, user->nick, "You cannot add yourself to your own DCCALLOW list!");
+                                               user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, "You cannot add yourself to your own DCCALLOW list!");
                                                return CMD_FAILURE;
                                        }
 
@@ -174,7 +192,7 @@ class CommandDccallow : public Command
 
                                        if (dl->size() >= maxentries)
                                        {
-                                               user->WriteNumeric(996, user->nick, "Too many nicks on DCCALLOW list");
+                                               user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, "Too many nicks on DCCALLOW list");
                                                return CMD_FAILURE;
                                        }
 
@@ -182,7 +200,7 @@ class CommandDccallow : public Command
                                        {
                                                if (k->nickname == target->nick)
                                                {
-                                                       user->WriteNumeric(996, user->nick, InspIRCd::Format("%s is already on your DCCALLOW list", target->nick.c_str()));
+                                                       user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, InspIRCd::Format("%s is already on your DCCALLOW list", target->nick.c_str()));
                                                        return CMD_FAILURE;
                                                }
                                        }
@@ -213,11 +231,11 @@ class CommandDccallow : public Command
 
                                        if (length > 0)
                                        {
-                                               user->WriteNumeric(993, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %ld seconds", target->nick.c_str(), length));
+                                               user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %ld seconds", target->nick.c_str(), length));
                                        }
                                        else
                                        {
-                                               user->WriteNumeric(994, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for this session", target->nick.c_str()));
+                                               user->WriteNumeric(RPL_DCCALLOWPERMANENT, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for this session", target->nick.c_str()));
                                        }
 
                                        /* route it. */
@@ -242,8 +260,8 @@ class CommandDccallow : public Command
        void DisplayHelp(User* user)
        {
                for (size_t i = 0; i < sizeof(helptext)/sizeof(helptext[0]); i++)
-                       user->WriteNumeric(998, helptext[i]);
-               user->WriteNumeric(999, "End of DCCALLOW HELP");
+                       user->WriteNumeric(RPL_DCCALLOWHELP, helptext[i]);
+               user->WriteNumeric(RPL_ENDOFDCCALLOWHELP, "End of DCCALLOW HELP");
 
                LocalUser* localuser = IS_LOCAL(user);
                if (localuser)
@@ -253,18 +271,18 @@ class CommandDccallow : public Command
        void DisplayDCCAllowList(User* user)
        {
                 // display current DCCALLOW list
-               user->WriteNumeric(990, "Users on your DCCALLOW list:");
+               user->WriteNumeric(RPL_DCCALLOWSTART, "Users on your DCCALLOW list:");
 
                dl = ext.get(user);
                if (dl)
                {
                        for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c)
                        {
-                               user->WriteNumeric(991, user->nick, InspIRCd::Format("%s (%s)", c->nickname.c_str(), c->hostmask.c_str()));
+                               user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, InspIRCd::Format("%s (%s)", c->nickname.c_str(), c->hostmask.c_str()));
                        }
                }
 
-               user->WriteNumeric(992, "End of DCCALLOW list");
+               user->WriteNumeric(RPL_DCCALLOWEND, "End of DCCALLOW list");
        }
 
 };
@@ -421,7 +439,7 @@ class ModuleDCCAllow : public Module
                                                time_t expires = iter2->set_on + iter2->length;
                                                if (iter2->length != 0 && expires <= ServerInstance->Time())
                                                {
-                                                       u->WriteNumeric(997, u->nick, InspIRCd::Format("DCCALLOW entry for %s has expired", iter2->nickname.c_str()));
+                                                       u->WriteNumeric(RPL_DCCALLOWEXPIRED, u->nick, InspIRCd::Format("DCCALLOW entry for %s has expired", iter2->nickname.c_str()));
                                                        iter2 = dl->erase(iter2);
                                                }
                                                else
@@ -456,7 +474,7 @@ class ModuleDCCAllow : public Module
                                                {
 
                                                        u->WriteNotice(i->nickname + " left the network or changed their nickname and has been removed from your DCCALLOW list");
-                                                       u->WriteNumeric(995, u->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", i->nickname.c_str()));
+                                                       u->WriteNumeric(RPL_DCCALLOWREMOVED, u->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", i->nickname.c_str()));
                                                        dl->erase(i);
                                                        break;
                                                }
index 8be05fd537e84533e8ec7eb7e0aab22f5df5967b..171893fd7238379c3ce576cfc96f64459ba60b51 100644 (file)
 
 #include "inspircd.h"
 
+enum
+{
+       // From UnrealIRCd.
+       ERR_CANNOTKNOCK = 480
+};
+
 /** Handles the /KNOCK command
  */
 class CommandKnock : public Command
@@ -57,7 +63,7 @@ class CommandKnock : public Command
 
                if (c->IsModeSet(noknockmode))
                {
-                       user->WriteNumeric(480, InspIRCd::Format("Can't KNOCK on %s, +K is set.", c->name.c_str()));
+                       user->WriteNumeric(ERR_CANNOTKNOCK, InspIRCd::Format("Can't KNOCK on %s, +K is set.", c->name.c_str()));
                        return CMD_FAILURE;
                }
 
index 5c280b355eb7113968024be19384ab5e39ddca6b..73c5cb521fdc919572e5576ca2a474b8fef6a3da 100644 (file)
 
 #include "inspircd.h"
 
+enum
+{
+       // InspIRCd-specific.
+       RPL_ENDOFPROPLIST = 960,
+       RPL_PROPLIST = 961
+};
+
 static void DisplayList(LocalUser* user, Channel* channel)
 {
-       Numeric::ParamBuilder<1> numeric(user, 961);
+       Numeric::ParamBuilder<1> numeric(user, RPL_PROPLIST);
        numeric.AddStatic(channel->name);
 
        const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL);
@@ -40,7 +47,7 @@ static void DisplayList(LocalUser* user, Channel* channel)
                }
        }
        numeric.Flush();
-       user->WriteNumeric(960, channel->name, "End of mode list");
+       user->WriteNumeric(RPL_ENDOFPROPLIST, channel->name, "End of mode list");
 }
 
 class CommandProp : public SplitCommand
index 1226b601aacb0814e5c17fa2af6ae8b572526357..cea05676055aa46c49c209e95563d4c97515da66 100644 (file)
 enum
 {
        // From AustHex.
-       RPL_WHOISSERVICE = 310
+       RPL_WHOISSERVICE = 310,
+
+       // From UnrealIRCd.
+       ERR_KILLDENY = 485
 };
 
 /** Handles user mode +k
@@ -112,7 +115,7 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public
 
                if (dst->IsModeSet(bm))
                {
-                       src->WriteNumeric(485, InspIRCd::Format("You are not permitted to kill %s services!", ServerInstance->Config->Network.c_str()));
+                       src->WriteNumeric(ERR_KILLDENY, InspIRCd::Format("You are not permitted to kill %s services!", ServerInstance->Config->Network.c_str()));
                        ServerInstance->SNO->WriteGlobalSno('a', src->nick+" tried to kill service "+dst->nick+" ("+reason+")");
                        return MOD_RES_DENY;
                }
index 0aa957e1d192e2e727160192e249d035f26c15c1..fd6d889d444e542ceb44980ce71684ba8063d053 100644 (file)
@@ -57,6 +57,17 @@ static int SILENCE_CNOTICE   = 0x0010; /* t  channel notices       */
 static int SILENCE_ALL         = 0x0020; /* a  all, (pcint)          */
 static int SILENCE_EXCLUDE     = 0x0040; /* x  exclude this pattern  */
 
+enum
+{
+       // From ircu?
+       RPL_SILELIST = 271,
+       RPL_ENDOFSILELIST = 272,
+
+       // InspIRCd-specific.
+       RPL_UNSILENCED = 950,
+       RPL_SILENCED = 951,
+       ERR_NOTSILENCED = 952
+};
 
 class CommandSVSSilence : public Command
 {
@@ -122,10 +133,10 @@ class CommandSilence : public Command
                                for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++)
                                {
                                        std::string decomppattern = DecompPattern(c->second);
-                                       user->WriteNumeric(271, user->nick, c->first, decomppattern);
+                                       user->WriteNumeric(RPL_SILELIST, user->nick, c->first, decomppattern);
                                }
                        }
-                       user->WriteNumeric(272, "End of Silence List");
+                       user->WriteNumeric(RPL_ENDOFSILELIST, "End of Silence List");
 
                        return CMD_SUCCESS;
                }
@@ -171,7 +182,7 @@ class CommandSilence : public Command
                                                if ((irc::equals(listitem, mask)) && (i->second == pattern))
                                                {
                                                        sl->erase(i);
-                                                       user->WriteNumeric(950, user->nick, InspIRCd::Format("Removed %s %s from silence list", mask.c_str(), decomppattern.c_str()));
+                                                       user->WriteNumeric(RPL_UNSILENCED, user->nick, InspIRCd::Format("Removed %s %s from silence list", mask.c_str(), decomppattern.c_str()));
                                                        if (!sl->size())
                                                        {
                                                                ext.unset(user);
@@ -180,7 +191,7 @@ class CommandSilence : public Command
                                                }
                                        }
                                }
-                               user->WriteNumeric(952, user->nick, InspIRCd::Format("%s %s does not exist on your silence list", mask.c_str(), decomppattern.c_str()));
+                               user->WriteNumeric(ERR_NOTSILENCED, user->nick, InspIRCd::Format("%s %s does not exist on your silence list", mask.c_str(), decomppattern.c_str()));
                        }
                        else if (action == '+')
                        {
@@ -193,7 +204,7 @@ class CommandSilence : public Command
                                }
                                if (sl->size() > maxsilence)
                                {
-                                       user->WriteNumeric(952, user->nick, "Your silence list is full");
+                                       user->WriteNumeric(ERR_NOTSILENCED, user->nick, "Your silence list is full");
                                        return CMD_FAILURE;
                                }
 
@@ -203,7 +214,7 @@ class CommandSilence : public Command
                                        const std::string& listitem = n->first;
                                        if ((irc::equals(listitem, mask)) && (n->second == pattern))
                                        {
-                                               user->WriteNumeric(952, user->nick, InspIRCd::Format("%s %s is already on your silence list", mask.c_str(), decomppattern.c_str()));
+                                               user->WriteNumeric(ERR_NOTSILENCED, user->nick, InspIRCd::Format("%s %s is already on your silence list", mask.c_str(), decomppattern.c_str()));
                                                return CMD_FAILURE;
                                        }
                                }
@@ -215,7 +226,7 @@ class CommandSilence : public Command
                                {
                                        sl->push_back(silenceset(mask,pattern));
                                }
-                               user->WriteNumeric(951, user->nick, InspIRCd::Format("Added %s %s to silence list", mask.c_str(), decomppattern.c_str()));
+                               user->WriteNumeric(RPL_SILENCED, user->nick, InspIRCd::Format("Added %s %s to silence list", mask.c_str(), decomppattern.c_str()));
                                return CMD_SUCCESS;
                        }
                }
index 746ade2acd51afd0f492304a2df5122c8160bd71..76fc6ebf062ded015ddaf00f9f2480a73e72b7ac 100644 (file)
@@ -190,7 +190,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener
 
                                if (ifo->oper_block->getBool("sslonly") && !cert)
                                {
-                                       user->WriteNumeric(491, "This oper login requires an SSL connection.");
+                                       user->WriteNumeric(ERR_NOOPERHOST, "This oper login requires an SSL connection.");
                                        user->CommandFloodPenalty += 10000;
                                        return MOD_RES_DENY;
                                }
@@ -198,7 +198,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener
                                std::string fingerprint;
                                if (ifo->oper_block->readString("fingerprint", fingerprint) && (!cert || cert->GetFingerprint() != fingerprint))
                                {
-                                       user->WriteNumeric(491, "This oper login requires a matching SSL certificate fingerprint.");
+                                       user->WriteNumeric(ERR_NOOPERHOST, "This oper login requires a matching SSL certificate fingerprint.");
                                        user->CommandFloodPenalty += 10000;
                                        return MOD_RES_DENY;
                                }
index 25c98e77c693dec7355a2adc2a41ecfed7bc883a..b8390c0063b38915deaf12a9bf8d7b7c77a1df30 100644 (file)
 #include "inspircd.h"
 #include "modules/invite.h"
 
+enum
+{
+       // InspIRCd-specific.
+       RPL_UNINVITED = 493
+};
+
 /** Handle /UNINVITE
  */
 class CommandUninvite : public Command
@@ -93,7 +99,7 @@ class CommandUninvite : public Command
                        n.push(c->name).push(u->nick).push("Uninvited");
                        user->WriteRemoteNumeric(n);
 
-                       lu->WriteNumeric(493, InspIRCd::Format("You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str()));
+                       lu->WriteNumeric(RPL_UNINVITED, InspIRCd::Format("You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str()));
 
                        std::string msg = "*** " + user->nick + " uninvited " + u->nick + ".";
                        c->WriteNotice(msg);
index ba5ce10bd80c2b298808e4c1ee12d5de1a0f3606..63e34220a4531a48d4910e08a09c65e7810f5224 100644 (file)
@@ -36,7 +36,8 @@ enum
        RPL_ENDOFWATCHLIST = 607,
        // RPL_CLEARWATCH = 608, // unused
        RPL_NOWISAWAY = 609,
-       ERR_TOOMANYWATCH = 512
+       ERR_TOOMANYWATCH = 512,
+       ERR_INVALIDWATCHNICK = 942
 };
 
 class CommandWatch : public SplitCommand
@@ -72,7 +73,7 @@ class CommandWatch : public SplitCommand
                }
                else if (result == IRCv3::Monitor::Manager::WR_INVALIDNICK)
                {
-                       user->WriteNumeric(942, nick, "Invalid nickname");
+                       user->WriteNumeric(ERR_INVALIDWATCHNICK, nick, "Invalid nickname");
                        return;
                }
                else if (result != IRCv3::Monitor::Manager::WR_OK)