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 * ---------------------------------------------------
17 /* $ModDesc: Provides the NAMESX (CAP multi-prefix) capability. */
19 class ModuleNamesX : public Module
23 ModuleNamesX(InspIRCd* Me)
26 Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric, I_OnEvent };
27 ServerInstance->Modules->Attach(eventlist, this, 5);
31 virtual ~ModuleNamesX()
35 void OnSyncUserMetaData(User* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
37 if ((displayable) && (extname == "NAMESX"))
38 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "Enabled");
41 virtual Version GetVersion()
43 return Version(1,2,0,1,VF_VENDOR,API_VERSION);
46 virtual void On005Numeric(std::string &output)
48 output.append(" NAMESX");
51 virtual int OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line)
53 irc::string c = command.c_str();
54 /* We don't actually create a proper command handler class for PROTOCTL,
55 * because other modules might want to have PROTOCTL hooks too.
56 * Therefore, we just hook its as an unvalidated command therefore we
57 * can capture it even if it doesnt exist! :-)
61 if ((parameters.size()) && (!strcasecmp(parameters[0].c_str(),"NAMESX")))
63 user->Extend("NAMESX");
70 virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick)
72 if (!issuer->GetExt("NAMESX"))
75 /* Some module hid this from being displayed, dont bother */
79 prefixes = channel->GetAllPrefixChars(user);
82 virtual void OnEvent(Event *ev)
84 GenericCapHandler(ev, "NAMESX", "multi-prefix");
88 MODULE_INIT(ModuleNamesX)