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 * ---------------------------------------------------
26 /* $ModDesc: Provides support for unreal-style channel mode +T */
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 ServerInstance->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 ((ServerInstance->ULine(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)
103 virtual ~ModuleNoNotice()
108 virtual Version GetVersion()
110 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
115 class ModuleNoNoticeFactory : public ModuleFactory
118 ModuleNoNoticeFactory()
122 ~ModuleNoNoticeFactory()
126 virtual Module * CreateModule(InspIRCd* Me)
128 return new ModuleNoNotice(Me);
134 extern "C" void * init_module( void )
136 return new ModuleNoNoticeFactory;