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 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style channel mode +T */
18 class NoNotice : public ModeHandler
21 NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { }
23 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
27 if (!channel->IsModeSet('T'))
29 channel->SetMode('T',true);
30 return MODEACTION_ALLOW;
35 if (channel->IsModeSet('T'))
37 channel->SetMode('T',false);
38 return MODEACTION_ALLOW;
42 return MODEACTION_DENY;
46 class ModuleNoNotice : public Module
52 ModuleNoNotice(InspIRCd* Me)
56 nt = new NoNotice(ServerInstance);
57 if (!ServerInstance->AddMode(nt, 'T'))
58 throw ModuleException("Could not add new modes!");
61 void Implements(char* List)
63 List[I_OnUserPreNotice] = 1;
66 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
68 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
70 chanrec* c = (chanrec*)dest;
71 if (c->IsModeSet('T'))
73 if ((ServerInstance->ULine(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
75 // ops and halfops can still /NOTICE the channel
80 user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
88 virtual ~ModuleNoNotice()
90 ServerInstance->Modes->DelMode(nt);
94 virtual Version GetVersion()
96 return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
100 MODULE_INIT(ModuleNoNotice)