1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
19 /* $ModDesc: Provides support for unreal-style channel mode +T */
21 class NoNotice : public ModeHandler
24 NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { }
26 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
30 if (!channel->IsModeSet('T'))
32 channel->SetMode('T',true);
33 return MODEACTION_ALLOW;
38 if (channel->IsModeSet('T'))
40 channel->SetMode('T',false);
41 return MODEACTION_ALLOW;
45 return MODEACTION_DENY;
49 class ModuleNoNotice : public Module
55 ModuleNoNotice(InspIRCd* Me)
59 nt = new NoNotice(ServerInstance);
60 ServerInstance->AddMode(nt, 'T');
63 void Implements(char* List)
65 List[I_OnUserPreNotice] = 1;
68 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
70 if (target_type == TYPE_CHANNEL)
72 chanrec* c = (chanrec*)dest;
73 if (c->IsModeSet('T'))
75 if ((ServerInstance->ULine(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
77 // ops and halfops can still /NOTICE the channel
82 user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
90 virtual ~ModuleNoNotice()
92 ServerInstance->Modes->DelMode(nt);
96 virtual Version GetVersion()
98 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
103 class ModuleNoNoticeFactory : public ModuleFactory
106 ModuleNoNoticeFactory()
110 ~ModuleNoNoticeFactory()
114 virtual Module * CreateModule(InspIRCd* Me)
116 return new ModuleNoNotice(Me);
122 extern "C" void * init_module( void )
124 return new ModuleNoNoticeFactory;