]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_delaymsg.cpp
DLLFactory--
[user/henk/code/inspircd.git] / src / modules / m_delaymsg.cpp
index 5e2bb838cce057f7d5032a9e86c25877b121195a..75a1df19a92050cdacc960953acdc3d2226b47db 100644 (file)
@@ -22,7 +22,11 @@ class DelayMsgMode : public ModeHandler
        CUList empty;
  public:
        LocalIntExt jointime;
-       DelayMsgMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, Parent, 'd', 1, 0, false, MODETYPE_CHANNEL, false, 0, '@'), jointime("delaymsg", Parent) {};
+       DelayMsgMode(Module* Parent) : ModeHandler(Parent, "delaymsg", 'd', PARAM_SETONLY, MODETYPE_CHANNEL)
+               , jointime("delaymsg", Parent)
+       {
+               levelrequired = OP_VALUE;
+       }
 
        ModePair ModeSet(User*, User*, Channel* channel, const std::string &parameter)
        {
@@ -37,7 +41,7 @@ class DelayMsgMode : public ModeHandler
                }
        }
 
-       bool CheckTimeStamp(std::string &their_param, const std::string &our_param, Channel*)
+       bool ResolveModeConflict(std::string &their_param, const std::string &our_param, Channel*)
        {
                return (atoi(their_param.c_str()) < atoi(our_param.c_str()));
        }
@@ -50,7 +54,7 @@ class ModuleDelayMsg : public Module
  private:
        DelayMsgMode djm;
  public:
-       ModuleDelayMsg(InspIRCd* Me) : Module(Me), djm(Me, this)
+       ModuleDelayMsg() : djm(this)
        {
                if (!ServerInstance->Modes->AddMode(&djm))
                        throw ModuleException("Could not add new modes!");
@@ -60,10 +64,7 @@ class ModuleDelayMsg : public Module
        }
        ~ModuleDelayMsg();
        Version GetVersion();
-       void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created);
-       void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
-       void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent);
-       void OnCleanup(int target_type, void* item);
+       void OnUserJoin(Membership* memb, bool sync, bool created, CUList&);
        ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list);
 };
 
@@ -95,19 +96,17 @@ ModeAction DelayMsgMode::OnModeChange(User* source, User* dest, Channel* channel
 
 ModuleDelayMsg::~ModuleDelayMsg()
 {
-       ServerInstance->Modes->DelMode(&djm);
 }
 
 Version ModuleDelayMsg::GetVersion()
 {
-       return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+       return Version("Provides channelmode +d <int>, to deny messages to a channel until <int> seconds.", VF_COMMON | VF_VENDOR, API_VERSION);
 }
 
-void ModuleDelayMsg::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created)
+void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)
 {
-       if (channel->IsModeSet('d'))
+       if (memb->chan->IsModeSet('d'))
        {
-               Membership* memb = channel->GetUser(user);
                djm.jointime.set(memb, ServerInstance->Time());
        }
 }