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, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'T') { }
24 class ModuleNoNotice : public Module
29 ModuleNoNotice(InspIRCd* Me)
30 : Module(Me), nt(Me, this)
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 ModResult 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->GetExtBanStatus(user, 'T').check(!c->IsModeSet('T')))
50 if (ServerInstance->ULine(user->server))
53 return MOD_RES_PASSTHRU;
55 else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetPrefixValue(user) == OP_VALUE)
57 // channel ops are exempt if set in conf.
58 return MOD_RES_PASSTHRU;
62 user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str());
67 return MOD_RES_PASSTHRU;
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)