ModuleKickNoRejoin()
: kr(this)
{
- if (!ServerInstance->Modes->AddMode(&kr))
- throw ModuleException("Could not add new modes!");
- ServerInstance->Extensions.Register(&kr.ext);
+ }
+
+ void init()
+ {
+ ServerInstance->Modules->AddService(kr);
+ ServerInstance->Modules->AddService(kr.ext);
Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick };
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
if (iter->first == user)
{
+ std::string modeparam = chan->GetModeParameter(&kr);
user->WriteNumeric(ERR_DELAYREJOIN, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)",
- user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter(&kr).c_str());
+ user->nick.c_str(), chan->name.c_str(), modeparam.c_str());
return MOD_RES_DENY;
}
}
dl = new delaylist;
kr.ext.set(memb->chan, dl);
}
- (*dl)[memb->user] = ServerInstance->Time() + atoi(memb->chan->GetModeParameter(&kr).c_str());
+ (*dl)[memb->user] = ServerInstance->Time() + ConvToInt(memb->chan->GetModeParameter(&kr));
}
}