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 UHNAMES facility. */
19 class ModuleUHNames : public Module
24 ModuleUHNames(InspIRCd* Me)
27 Implementation eventlist[] = { I_OnEvent, I_OnSyncUserMetaData, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric };
28 ServerInstance->Modules->Attach(eventlist, this, 5);
31 virtual ~ModuleUHNames()
35 void OnSyncUserMetaData(User* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
37 if ((displayable) && (extname == "UHNAMES"))
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(" UHNAMES");
51 virtual int OnPreCommand(const std::string &command, const 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(),"UHNAMES")))
63 user->Extend("UHNAMES");
70 virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick)
72 if (!issuer->GetExt("UHNAMES"))
78 nick = user->GetFullHost();
81 virtual void OnEvent(Event* ev)
83 GenericCapHandler(ev, "UHNAMES", "userhost-in-names");
87 MODULE_INIT(ModuleUHNames)