1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
24 /* $ModDesc: Provides support for unreal-style channel mode +T */
26 class NoNotice : public ModeHandler
29 NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { }
31 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
35 if (!channel->IsModeSet('T'))
37 channel->SetMode('T',true);
38 return MODEACTION_ALLOW;
43 if (channel->IsModeSet('T'))
45 channel->SetMode('T',false);
46 return MODEACTION_ALLOW;
50 return MODEACTION_DENY;
54 class ModuleNoNotice : public Module
60 ModuleNoNotice(InspIRCd* Me)
64 nt = new NoNotice(ServerInstance);
65 ServerInstance->AddMode(nt, 'T');
68 void Implements(char* List)
70 List[I_OnUserPreNotice] = 1;
73 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
75 if (target_type == TYPE_CHANNEL)
77 chanrec* c = (chanrec*)dest;
78 if (c->IsModeSet('T'))
80 if ((ServerInstance->ULine(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
82 // ops and halfops can still /NOTICE the channel
87 user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
95 virtual ~ModuleNoNotice()
97 ServerInstance->Modes->DelMode(nt);
101 virtual Version GetVersion()
103 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
108 class ModuleNoNoticeFactory : public ModuleFactory
111 ModuleNoNoticeFactory()
115 ~ModuleNoNoticeFactory()
119 virtual Module * CreateModule(InspIRCd* Me)
121 return new ModuleNoNotice(Me);
127 extern "C" void * init_module( void )
129 return new ModuleNoNoticeFactory;