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 if (!ServerInstance->AddMode(nt, 'T'))
61 throw ModuleException("Could not add new modes!");
64 void Implements(char* List)
66 List[I_OnUserPreNotice] = 1;
69 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
71 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
73 chanrec* c = (chanrec*)dest;
74 if (c->IsModeSet('T'))
76 if ((ServerInstance->ULine(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
78 // ops and halfops can still /NOTICE the channel
83 user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
91 virtual ~ModuleNoNotice()
93 ServerInstance->Modes->DelMode(nt);
97 virtual Version GetVersion()
99 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
103 MODULE_INIT(ModuleNoNotice);