1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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 SimpleChannelModeHandler
21 NoNotice(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'T') { }
24 class ModuleNoNotice : public Module
29 ModuleNoNotice(InspIRCd* Me)
32 if (!ServerInstance->Modes->AddMode(&nt))
33 throw ModuleException("Could not add new modes!");
34 Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric };
35 ServerInstance->Modules->Attach(eventlist, this, 2);
38 virtual void On005Numeric(std::string &output)
40 ServerInstance->AddExtBanChar('T');
43 virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
45 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
47 Channel* c = (Channel*)dest;
48 if (c->IsModeSet('T') || c->GetExtBanStatus(user, 'T') < 0)
50 if (ServerInstance->ULine(user->server))
55 else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetStatus(user) == STATUS_OP)
57 // channel ops are exempt if set in conf.
62 user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str());
70 virtual ~ModuleNoNotice()
72 ServerInstance->Modes->DelMode(&nt);
75 virtual Version GetVersion()
77 return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
81 MODULE_INIT(ModuleNoNotice)