]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_delaymsg.cpp
Move OnSync{Channel,Network,User} to ServerEventListener.
[user/henk/code/inspircd.git] / src / modules / m_delaymsg.cpp
index c906e2c3064d5f2566182067f7a83a001471cdc7..247630e65e4a6e2d19186ace07144ad19ea155f9 100644 (file)
@@ -25,17 +25,17 @@ class DelayMsgMode : public ParamMode<DelayMsgMode, LocalIntExt>
        LocalIntExt jointime;
        DelayMsgMode(Module* Parent)
                : ParamMode<DelayMsgMode, LocalIntExt>(Parent, "delaymsg", 'd')
-               , jointime("delaymsg", Parent)
+               , jointime("delaymsg", ExtensionItem::EXT_MEMBERSHIP, Parent)
        {
-               levelrequired = OP_VALUE;
+               ranktoset = ranktounset = OP_VALUE;
        }
 
-       bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel*)
+       bool ResolveModeConflict(std::string& their_param, const std::string& our_param, Channel*) CXX11_OVERRIDE
        {
                return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
        }
 
-       ModeAction OnSet(User* source, Channel* chan, std::string& parameter);
+       ModeAction OnSet(User* source, Channel* chan, std::string& parameter) CXX11_OVERRIDE;
        void OnUnset(User* source, Channel* chan);
 
        void SerializeParam(Channel* chan, int n, std::string& out)
@@ -95,8 +95,7 @@ void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CULis
 
 ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype)
 {
-       /* Server origin */
-       if ((!user) || (!IS_LOCAL(user)))
+       if (!IS_LOCAL(user))
                return MOD_RES_PASSTHRU;
 
        if ((target_type != TYPE_CHANNEL) || ((!allownotice) && (msgtype == MSG_NOTICE)))
@@ -119,8 +118,7 @@ ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_ty
        {
                if (channel->GetPrefixValue(user) < VOICE_VALUE)
                {
-                       user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :You must wait %d seconds after joining to send to channel (+d)",
-                               channel->name.c_str(), len);
+                       user->WriteNumeric(ERR_CANNOTSENDTOCHAN, channel->name, InspIRCd::Format("You must wait %d seconds after joining to send to channel (+d)", len));
                        return MOD_RES_DENY;
                }
        }