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"
26 /* $ModDesc: Provides support for unreal-style channel mode +T */
28 extern InspIRCd* ServerInstance;
30 class NoNotice : public ModeHandler
33 NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { }
35 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
39 if (!channel->IsModeSet('T'))
41 channel->SetMode('T',true);
42 return MODEACTION_ALLOW;
47 if (channel->IsModeSet('T'))
49 channel->SetMode('T',false);
50 return MODEACTION_ALLOW;
54 return MODEACTION_DENY;
58 class ModuleNoNotice : public Module
64 ModuleNoNotice(InspIRCd* Me)
68 nt = new NoNotice(ServerInstance);
69 Srv->AddMode(nt, 'T');
72 void Implements(char* List)
74 List[I_OnUserPreNotice] = List[I_On005Numeric] = 1;
77 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status)
79 if (target_type == TYPE_CHANNEL)
81 chanrec* c = (chanrec*)dest;
82 if (c->IsModeSet('T'))
84 if ((Srv->IsUlined(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
86 // ops and halfops can still /NOTICE the channel
91 user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
99 virtual void On005Numeric(std::string &output)
101 ServerInstance->ModeGrok->InsertMode(output,"T",4);
104 virtual ~ModuleNoNotice()
109 virtual Version GetVersion()
111 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
116 class ModuleNoNoticeFactory : public ModuleFactory
119 ModuleNoNoticeFactory()
123 ~ModuleNoNoticeFactory()
127 virtual Module * CreateModule(InspIRCd* Me)
129 return new ModuleNoNotice(Me);
135 extern "C" void * init_module( void )
137 return new ModuleNoNoticeFactory;