diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-21 16:17:03 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-21 16:17:03 +0000 |
commit | f6b8a12a8066b60446570729f77084116853fe2e (patch) | |
tree | 982ff1e2795b3378cc8c7874202ed09a75ed97e1 /src/modules/m_uhnames.cpp | |
parent | b4d1587b44ca01ef90c64cb21e5ddc0783564491 (diff) |
Convert to new api
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9144 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_uhnames.cpp')
-rw-r--r-- | src/modules/m_uhnames.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
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) |