1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 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 j: - matching channel bans */
18 class ModuleBadChannelExtban : public Module
22 ModuleBadChannelExtban() {
23 Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
24 ServerInstance->Modules->Attach(eventlist, this, 2);
27 ~ModuleBadChannelExtban()
33 return Version("Extban 'j' - channel status/join ban", VF_OPTCOMMON|VF_VENDOR);
36 ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
38 if (mask[0] == 'j' && mask[1] == ':')
40 std::string rm = mask.substr(2);
42 ModeHandler* mh = ServerInstance->Modes->FindPrefix(rm[0]);
46 status = mh->GetModeChar();
48 for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
50 if (InspIRCd::Match((**i).name, rm))
54 Membership* memb = c->GetUser(user);
55 if (memb->hasMode(status))
63 return MOD_RES_PASSTHRU;
66 void On005Numeric(std::string &output)
68 ServerInstance->AddExtBanChar('j');
73 MODULE_INIT(ModuleBadChannelExtban)