public:
ModuleDelayMsg() : djm(this)
{
- if (!ServerInstance->Modes->AddMode(&djm))
- throw ModuleException("Could not add new modes!");
- ServerInstance->Extensions.Register(&djm.jointime);
+ }
+
+ void init()
+ {
+ ServerInstance->Modules->AddService(djm);
+ ServerInstance->Modules->AddService(djm.jointime);
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPreMessage};
- ServerInstance->Modules->Attach(eventlist, this, 2);
+ ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
Version GetVersion();
void OnUserJoin(Membership* memb, bool sync, bool created, CUList&);
{
if (adding)
{
+ if ((channel->IsModeSet('d')) && (channel->GetModeParameter('d') == parameter))
+ return MODEACTION_DENY;
+
/* Setting a new limit, sanity check */
long limit = atoi(parameter.c_str());
void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)
{
- if (memb->chan->IsModeSet('d'))
+ if ((IS_LOCAL(memb->user)) && (memb->chan->IsModeSet('d')))
{
djm.jointime.set(memb, ServerInstance->Time());
}
ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
{
/* Server origin */
- if (!user)
+ if ((!user) || (!IS_LOCAL(user)))
return MOD_RES_PASSTHRU;
if (target_type != TYPE_CHANNEL)