From f6b8a12a8066b60446570729f77084116853fe2e Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 21 Mar 2008 16:17:03 +0000 Subject: Convert to new api git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9144 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_uhnames.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'src/modules/m_uhnames.cpp') diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index dddf45591..b56ed5229 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -15,7 +15,7 @@ static const char* dummy = "ON"; -/* $ModDesc: Provides aliases of commands. */ +/* $ModDesc: Provides the UHNAMES facility. */ class ModuleUHNames : public Module { @@ -25,11 +25,10 @@ class ModuleUHNames : public Module ModuleUHNames(InspIRCd* Me) : Module(Me) { - Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnPreCommand, I_OnUserList, I_On005Numeric }; + Implementation eventlist[] = { I_OnSyncUserMetaData, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 4); } - virtual ~ModuleUHNames() { } @@ -50,12 +49,6 @@ class ModuleUHNames : public Module output.append(" UHNAMES"); } - void Prioritize() - { - Module* namesx = ServerInstance->Modules->Find("m_namesx.so"); - ServerInstance->Modules->SetPriority(this, I_OnUserList, PRIO_BEFORE, &namesx); - } - virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line) { irc::string c = command.c_str(); @@ -75,19 +68,16 @@ class ModuleUHNames : public Module return 0; } - /* IMPORTANT: This must be prioritized above NAMESX! */ - virtual int OnUserList(User* user, Channel* Ptr, CUList* &ulist) + virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick) { - if (user->GetExt("UHNAMES")) - { - if (!ulist) - ulist = Ptr->GetUsers(); + if (!issuer->GetExt("UHNAMES")) + return; - for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) - i->second = i->first->GetFullHost(); - } - return 0; - } + if (nick.empty()) + return; + + nick = user->GetFullHost(); + } }; MODULE_INIT(ModuleUHNames) -- cgit v1.2.3