1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Implements extban +b r: - realname (gecos) bans */
18 class ModuleNickBan : public Module
22 ModuleNickBan(InspIRCd* Me) : Module(Me)
24 Implementation eventlist[] = { I_OnUserPreJoin, I_On005Numeric };
25 ServerInstance->Modules->Attach(eventlist, this, 2);
28 virtual ~ModuleNickBan()
32 virtual Version GetVersion()
34 return Version(1,2,0,0,VF_VENDOR,API_VERSION);
37 virtual int OnUserPreJoin(User *user, Channel *c, const char *cname, std::string &privs, const std::string &key)
45 if (c->IsExtBanned(user->fullname, 'r'))
47 // XXX: send a numeric here
48 user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot join " + c->name + ", as you match a ban");
55 virtual void On005Numeric(std::string &output)
57 if (output.find(" EXTBAN=:") == std::string::npos)
58 output.append(" EXTBAN=:r");
60 output.insert(output.find(" EXTBAN=:") + 9, "r");
65 MODULE_INIT(ModuleNickBan)