/* $ModDesc: Provides support for unreal-style channel mode +T */
-class NoNotice : public ModeHandler
+class NoNotice : public SimpleChannelModeHandler
{
public:
- NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { }
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
- {
- if (adding)
- {
- if (!channel->IsModeSet('T'))
- {
- channel->SetMode('T',true);
- return MODEACTION_ALLOW;
- }
- }
- else
- {
- if (channel->IsModeSet('T'))
- {
- channel->SetMode('T',false);
- return MODEACTION_ALLOW;
- }
- }
-
- return MODEACTION_DENY;
- }
+ NoNotice(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'T') { }
};
class ModuleNoNotice : public Module
{
nt = new NoNotice(ServerInstance);
- if (!ServerInstance->AddMode(nt))
+ if (!ServerInstance->Modes->AddMode(nt))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserPreNotice };
ServerInstance->Modules->Attach(eventlist, this, 1);
Channel* c = (Channel*)dest;
if (c->IsModeSet('T'))
{
- if ((ServerInstance->ULine(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
+ if (ServerInstance->ULine(user->server))
+ {
+ // ulines are exempt.
+ return 0;
+ }
+ else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetStatus(user) == STATUS_OP)
{
- // ops and halfops can still /NOTICE the channel
+ // channel ops are exempt if set in conf.
return 0;
}
else
{
- user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
+ user->WriteNumeric(404, "%s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
return 1;
}
}
virtual Version GetVersion()
{
- return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
+ return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
}
};