summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-01-27 12:24:47 +0000
committerPeter Powell <petpow@saberuk.com>2018-02-02 10:43:32 +0000
commitc2376ac6f49ab01794a21a3e9bb7c1b3c5a1c2d8 (patch)
tree48945089a65ba91aa1414821b60f88fae1592c2a
parentd5a6054948502625d7f0c235f6faaeea58734de5 (diff)
Add names for a bunch of numerics.
-rw-r--r--include/numerics.h2
-rw-r--r--src/modules/m_abbreviation.cpp10
-rw-r--r--src/modules/m_chanfilter.cpp14
-rw-r--r--src/modules/m_dccallow.cpp46
-rw-r--r--src/modules/m_knock.cpp8
-rw-r--r--src/modules/m_namedmodes.cpp11
-rw-r--r--src/modules/m_servprotect.cpp7
-rw-r--r--src/modules/m_silence.cpp25
-rw-r--r--src/modules/m_sslinfo.cpp4
-rw-r--r--src/modules/m_uninvite.cpp8
-rw-r--r--src/modules/m_watch.cpp5
11 files changed, 102 insertions, 38 deletions
diff --git a/include/numerics.h b/include/numerics.h
index 740ee1797..2a3f090e7 100644
--- a/include/numerics.h
+++ b/include/numerics.h
@@ -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. :)
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp
index 2a38bd3a6..c81caf142 100644
--- a/src/modules/m_abbreviation.cpp
+++ b/src/modules/m_abbreviation.cpp
@@ -19,6 +19,12 @@
#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;
}
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index d201f5418..70535a475 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -27,6 +27,14 @@
#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");
}
};
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 65eeeba11..0e6188339 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -25,6 +25,24 @@
#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;
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 8be05fd53..171893fd7 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -21,6 +21,12 @@
#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;
}
diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp
index 5c280b355..73c5cb521 100644
--- a/src/modules/m_namedmodes.cpp
+++ b/src/modules/m_namedmodes.cpp
@@ -19,9 +19,16 @@
#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
diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp
index 1226b601a..cea056760 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -24,7 +24,10 @@
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;
}
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 0aa957e1d..fd6d889d4 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -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;
}
}
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 746ade2ac..76fc6ebf0 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -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;
}
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index 25c98e77c..b8390c006 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -23,6 +23,12 @@
#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);
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index ba5ce10bd..63e34220a 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -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)