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 j: - matching channel bans */
18 class ModuleBadChannelExtban : public Module
22 ModuleBadChannelExtban(InspIRCd* Me) : Module(Me)
24 Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
25 ServerInstance->Modules->Attach(eventlist, this, 2);
28 ~ModuleBadChannelExtban()
34 return Version("Extban 'j' - channel status/join ban", VF_COMMON|VF_VENDOR,API_VERSION);
37 ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
39 if (mask[0] == 'j' && mask[1] == ':')
41 std::string rm = mask.substr(2);
43 ModeHandler* mh = ServerInstance->Modes->FindPrefix(rm[0]);
47 status = mh->GetModeChar();
49 for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
51 if (InspIRCd::Match((**i).name, rm))
55 Membership* memb = c->GetUser(user);
56 if (memb->hasMode(status))
64 return MOD_RES_PASSTHRU;
67 void On005Numeric(std::string &output)
69 ServerInstance->AddExtBanChar('j');
74 MODULE_INIT(ModuleBadChannelExtban)