]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_kicknorejoin.cpp
Improvements and bugfixes to the cgiirc module.
[user/henk/code/inspircd.git] / src / modules / m_kicknorejoin.cpp
index b8a7766675e8e191ea0cb45331ba495058f695d9..7d0e7fb8930ae16767a904841204412c79620cf2 100644 (file)
 
 #include "inspircd.h"
 
+enum
+{
+       // From RFC 2182.
+       ERR_UNAVAILRESOURCE = 437
+};
+
+
 class KickRejoinData
 {
        struct KickedUser
@@ -91,11 +98,14 @@ class KickRejoin : public ParamMode<KickRejoin, SimpleExtItem<KickRejoinData> >
        {
        }
 
-       ModeAction OnSet(User* source, Channel* channel, std::string& parameter)
+       ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE
        {
                int v = ConvToInt(parameter);
                if (v <= 0)
+               {
+                       source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter));
                        return MODEACTION_DENY;
+               }
 
                if ((IS_LOCAL(source) && ((unsigned int)v > max)))
                        v = max;
@@ -132,7 +142,7 @@ public:
                        const KickRejoinData* data = kr.ext.get(chan);
                        if ((data) && (!data->canjoin(user)))
                        {
-                               user->WriteNumeric(ERR_DELAYREJOIN, "%s :You must wait %u seconds after being kicked to rejoin (+J)", chan->name.c_str(), data->delay);
+                               user->WriteNumeric(ERR_UNAVAILRESOURCE, chan, InspIRCd::Format("You must wait %u seconds after being kicked to rejoin (+J)", data->delay));
                                return MOD_RES_DENY;
                        }
                }