1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 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 static const char* dummy = "ON";
18 /* $ModDesc: Provides aliases of commands. */
20 class ModuleUHNames : public Module
25 ModuleUHNames(InspIRCd* Me)
30 void Implements(char* List)
32 List[I_OnSyncUserMetaData] = List[I_OnPreCommand] = List[I_OnUserList] = List[I_On005Numeric] = 1;
35 virtual ~ModuleUHNames()
39 void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
41 if ((displayable) && (extname == "UHNAMES"))
42 proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "Enabled");
45 virtual Version GetVersion()
47 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
50 virtual void On005Numeric(std::string &output)
52 output.append(" UHNAMES");
57 return (Priority)ServerInstance->PriorityBefore("m_namesx.so");
60 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
62 irc::string c = command.c_str();
63 /* We don't actually create a proper command handler class for PROTOCTL,
64 * because other modules might want to have PROTOCTL hooks too.
65 * Therefore, we just hook its as an unvalidated command therefore we
66 * can capture it even if it doesnt exist! :-)
70 if ((pcnt) && (!strcasecmp(parameters[0],"UHNAMES")))
72 user->Extend("UHNAMES",dummy);
79 /* IMPORTANT: This must be prioritized above NAMESX! */
80 virtual int OnUserList(userrec* user, chanrec* Ptr, CUList* &ulist)
82 if (user->GetExt("UHNAMES"))
85 ulist = Ptr->GetUsers();
87 for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
88 i->second = i->first->GetFullHost();
94 MODULE_INIT(ModuleUHNames)