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: Implements extban +b m: - mute bans */
18 class ModuleQuietBan : public Module
22 ModuleQuietBan(InspIRCd* Me) : Module(Me)
24 Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric };
25 ServerInstance->Modules->Attach(eventlist, this, 3);
28 virtual ~ModuleQuietBan()
32 virtual Version GetVersion()
34 return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
37 virtual ModResult OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
39 if (!IS_LOCAL(user) || target_type != TYPE_CHANNEL)
40 return MOD_RES_PASSTHRU;
42 Channel* chan = static_cast<Channel*>(dest);
43 if (chan->GetExtBanStatus(user, 'm') == MOD_RES_DENY && chan->GetStatus(user) < STATUS_VOICE)
45 user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)", user->nick.c_str(), chan->name.c_str());
49 return MOD_RES_PASSTHRU;
52 virtual ModResult OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
54 return OnUserPreMessage(user, dest, target_type, text, status, exempt_list);
57 virtual void On005Numeric(std::string &output)
59 ServerInstance->AddExtBanChar('m');
64 MODULE_INIT(ModuleQuietBan)