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 * ---------------------------------------------------
23 #include "helperfuncs.h"
25 /* $ModDesc: Provides support for unreal-style channel mode +T */
27 class NoNotice : public ModeHandler
30 NoNotice() : ModeHandler('T', 0, 0, false, MODETYPE_CHANNEL, false) { }
32 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
36 if (!channel->IsModeSet('T'))
38 channel->SetMode('T',true);
39 return MODEACTION_ALLOW;
44 if (channel->IsModeSet('T'))
46 channel->SetMode('T',false);
47 return MODEACTION_ALLOW;
51 return MODEACTION_DENY;
55 class ModuleNoNotice : public Module
61 ModuleNoNotice(Server* Me)
66 Srv->AddMode(nt, 'T');
69 void Implements(char* List)
71 List[I_OnUserPreNotice] = List[I_On005Numeric] = 1;
74 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status)
76 if (target_type == TYPE_CHANNEL)
78 chanrec* c = (chanrec*)dest;
79 if (c->IsModeSet('T'))
81 if ((Srv->IsUlined(user->server)) || (Srv->ChanMode(user,c) == "@") || (Srv->ChanMode(user,c) == "%"))
83 // ops and halfops can still /NOTICE the channel
88 WriteServ(user->fd,"404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
96 virtual void On005Numeric(std::string &output)
98 InsertMode(output,"T",4);
101 virtual ~ModuleNoNotice()
106 virtual Version GetVersion()
108 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
113 class ModuleNoNoticeFactory : public ModuleFactory
116 ModuleNoNoticeFactory()
120 ~ModuleNoNoticeFactory()
124 virtual Module * CreateModule(Server* Me)
126 return new ModuleNoNotice(Me);
132 extern "C" void * init_module( void )
134 return new ModuleNoNoticeFactory;