]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Use consistent numerics when a mode already exists or doesn't exist.
authorPeter Powell <petpow@saberuk.com>
Sun, 9 Dec 2018 06:43:55 +0000 (06:43 +0000)
committerPeter Powell <petpow@saberuk.com>
Sun, 9 Dec 2018 06:57:10 +0000 (06:57 +0000)
include/numerics.h
src/listmode.cpp
src/modules/m_chanfilter.cpp
src/modules/m_exemptchanops.cpp

index 343f882527007117524d5341e32b274b78153121..8b574b24922519efc77e9520ba74f8ebe4a46074 100644 (file)
@@ -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
index 78908a727015036c25cdb8bd30a47f532da1e77a..61fadcade8c87ccef6baaa5beeb9b176653637ac 100644 (file)
@@ -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()));
 }
index 5591c7ef959788331465e2b3bf9d196c91f2d84f..42f43a76792d5c38d8f1bedb68497b1f685cca65 100644 (file)
 #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
index 411d0dd1568113f77f552ce3fb84d52dbe6ff411..058a16e6cb275df83788df9cfedb9fe4df1d7097 100644 (file)
@@ -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