]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_delaymsg.cpp
Properly cull TreeServer objects when quitting several of them
[user/henk/code/inspircd.git] / src / modules / m_delaymsg.cpp
index 9acfc57ea7bcb257e67540aae5d9b008bf0eebba..192bca15f146e20681c2aa643638ce4cd0833840 100644 (file)
@@ -22,26 +22,13 @@ class DelayMsgMode : public ModeHandler
        CUList empty;
  public:
        LocalIntExt jointime;
-       DelayMsgMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Parent, 'd', PARAM_SETONLY, MODETYPE_CHANNEL)
+       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)
-       {
-               std::string climit = channel->GetModeParameter('d');
-               if (!climit.empty())
-               {
-                       return std::make_pair(true, climit);
-               }
-               else
-               {
-                       return std::make_pair(false, parameter);
-               }
-       }
-
-       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()));
        }
@@ -54,11 +41,11 @@ 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!");
-               Extensible::Register(&djm.jointime);
+               ServerInstance->Extensions.Register(&djm.jointime);
                Implementation eventlist[] = { I_OnUserJoin, I_OnUserPreMessage};
                ServerInstance->Modules->Attach(eventlist, this, 2);
        }
@@ -96,12 +83,11 @@ ModeAction DelayMsgMode::OnModeChange(User* source, User* dest, Channel* channel
 
 ModuleDelayMsg::~ModuleDelayMsg()
 {
-       ServerInstance->Modes->DelMode(&djm);
 }
 
 Version ModuleDelayMsg::GetVersion()
 {
-       return Version("Provides channelmode +d <int>, to deny messages to a channel until <int> seconds.", 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);
 }
 
 void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)