summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-12-09 06:43:55 +0000
committerPeter Powell <petpow@saberuk.com>2018-12-09 06:57:10 +0000
commitdb5610a5640749ab7dafab82c1ef1553f3d78615 (patch)
tree9302c5ecc1b8ac299e379ef078ced426db63b8b3
parenta5b9f37d62670a49e81c5a53f93bdf485aace4a6 (diff)
Use consistent numerics when a mode already exists or doesn't exist.
-rw-r--r--include/numerics.h2
-rw-r--r--src/listmode.cpp7
-rw-r--r--src/modules/m_chanfilter.cpp17
-rw-r--r--src/modules/m_exemptchanops.cpp10
4 files changed, 7 insertions, 29 deletions
diff --git a/include/numerics.h b/include/numerics.h
index 343f88252..8b574b249 100644
--- a/include/numerics.h
+++ b/include/numerics.h
@@ -158,6 +158,8 @@ enum
RPL_SYNTAX = 650, // insp-specific
ERR_INVALIDMODEPARAM = 696, // insp-specific
+ ERR_LISTMODEALREADYSET = 697, // insp-specific
+ ERR_LISTMODENOTSET = 698, // insp-specific
RPL_OTHERUMODEIS = 803, // insp-specific
RPL_OTHERSNOMASKIS = 804, // insp-specific
diff --git a/src/listmode.cpp b/src/listmode.cpp
index 78908a727..61fadcade 100644
--- a/src/listmode.cpp
+++ b/src/listmode.cpp
@@ -223,6 +223,7 @@ bool ListModeBase::ValidateParam(User*, Channel*, std::string&)
void ListModeBase::OnParameterMissing(User*, User*, Channel*)
{
+ // Intentionally left blank.
}
void ListModeBase::TellListTooLong(User* source, Channel* channel, std::string& parameter)
@@ -230,10 +231,12 @@ void ListModeBase::TellListTooLong(User* source, Channel* channel, std::string&
source->WriteNumeric(ERR_BANLISTFULL, channel->name, parameter, mode, InspIRCd::Format("Channel %s list is full", name.c_str()));
}
-void ListModeBase::TellAlreadyOnList(User*, Channel*, std::string&)
+void ListModeBase::TellAlreadyOnList(User* source, Channel* channel, std::string& parameter)
{
+ source->WriteNumeric(ERR_LISTMODEALREADYSET, channel->name, parameter, mode, InspIRCd::Format("Channel %s list already contains %s", name.c_str(), parameter.c_str()));
}
-void ListModeBase::TellNotSet(User*, Channel*, std::string&)
+void ListModeBase::TellNotSet(User* source, Channel* channel, std::string& parameter)
{
+ source->WriteNumeric(ERR_LISTMODENOTSET, channel->name, parameter, mode, InspIRCd::Format("Channel %s list does not contain %s", name.c_str(), parameter.c_str()));
}
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 5591c7ef9..42f43a767 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -27,13 +27,6 @@
#include "listmode.h"
#include "modules/exemption.h"
-enum
-{
- // InspIRCd-specific.
- ERR_ALREADYCHANFILTERED = 937,
- ERR_NOSUCHCHANFILTER = 938
-};
-
/** Handles channel mode +g
*/
class ChanFilter : public ListModeBase
@@ -53,16 +46,6 @@ class ChanFilter : public ListModeBase
return true;
}
-
- void TellAlreadyOnList(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
- {
- 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(ERR_NOSUCHCHANFILTER, chan->name, "No such spamfilter word is set");
- }
};
class ModuleChanFilter : public Module
diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp
index 411d0dd15..058a16e6c 100644
--- a/src/modules/m_exemptchanops.cpp
+++ b/src/modules/m_exemptchanops.cpp
@@ -51,16 +51,6 @@ class ExemptChanOps : public ListModeBase
return true;
}
-
- void TellAlreadyOnList(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
- {
- user->WriteNumeric(957, chan->name, InspIRCd::Format("The word %s is already on the exemptchanops list", word.c_str()));
- }
-
- void TellNotSet(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE
- {
- user->WriteNumeric(958, chan->name, "No such exemptchanops word is set");
- }
};
class ExemptHandler : public CheckExemption::EventListener