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 * ---------------------------------------------------
19 static const char* dummy = "ON";
21 /* $ModDesc: Provides aliases of commands. */
23 class ModuleUHNames : public Module
28 ModuleUHNames(InspIRCd* Me)
33 void Implements(char* List)
35 List[I_OnPreCommand] = List[I_OnUserList] = List[I_On005Numeric] = 1;
38 virtual ~ModuleUHNames()
42 virtual Version GetVersion()
44 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
47 virtual void On005Numeric(std::string &output)
49 output.append(" UHNAMES");
54 return (Priority)ServerInstance->PriorityBefore("m_namesx.so");
57 virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line)
59 irc::string c = command.c_str();
60 /* We don't actually create a proper command handler class for PROTOCTL,
61 * because other modules might want to have PROTOCTL hooks too.
62 * Therefore, we just hook its as an unvalidated command therefore we
63 * can capture it even if it doesnt exist! :-)
67 if ((pcnt) && (!strcasecmp(parameters[0],"UHNAMES")))
69 user->Extend("UHNAMES",dummy);
76 /* IMPORTANT: This must be prioritized above NAMESX! */
77 virtual int OnUserList(userrec* user, chanrec* Ptr, CUList* &ulist)
79 if (user->GetExt("UHNAMES"))
82 ulist = Ptr->GetUsers();
84 for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
85 i->second = i->first->GetFullHost();
92 class ModuleUHNamesFactory : public ModuleFactory
95 ModuleUHNamesFactory()
99 ~ModuleUHNamesFactory()
103 virtual Module * CreateModule(InspIRCd* Me)
105 return new ModuleUHNames(Me);
110 extern "C" void * init_module( void )
112 return new ModuleUHNamesFactory;