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 * ---------------------------------------------------
17 /* $ModDesc: Provides the NAMESX (CAP multi-prefix) capability. */
19 class ModuleNamesX : public Module
23 ModuleNamesX() : cap(this, "multi-prefix")
25 Implementation eventlist[] = { I_OnPreCommand, I_OnNamesListItem, I_On005Numeric, I_OnEvent };
26 ServerInstance->Modules->Attach(eventlist, this, 4);
36 return Version("Provides the NAMESX (CAP multi-prefix) capability.",VF_VENDOR);
39 void On005Numeric(std::string &output)
41 output.append(" NAMESX");
44 ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
46 irc::string c = command.c_str();
47 /* We don't actually create a proper command handler class for PROTOCTL,
48 * because other modules might want to have PROTOCTL hooks too.
49 * Therefore, we just hook its as an unvalidated command therefore we
50 * can capture it even if it doesnt exist! :-)
54 if ((parameters.size()) && (!strcasecmp(parameters[0].c_str(),"NAMESX")))
60 return MOD_RES_PASSTHRU;
63 void OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick)
65 if (!cap.ext.get(issuer))
68 /* Some module hid this from being displayed, dont bother */
72 prefixes = memb->chan->GetAllPrefixChars(memb->user);
75 void OnEvent(Event& ev)
81 MODULE_INIT(ModuleNamesX)