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 | |
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')
-rw-r--r-- | src/channels.cpp | 16 | ||||
-rw-r--r-- | src/modules/m_namesx.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_uhnames.cpp | 30 |
3 files changed, 22 insertions, 26 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index a0c9a0304..8211b3564 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -838,13 +838,15 @@ void Channel::UserList(User *user, CUList *ulist) char list[MAXBUF]; size_t dlen, curlen; int MOD_RESULT = 0; + bool call_modules = true; if (!IS_LOCAL(user)) return; FOREACH_RESULT(I_OnUserList,OnUserList(user, this, ulist)); if (MOD_RESULT == 1) - return; + call_modules = false; + if (MOD_RESULT != -1) { if ((this->IsModeSet('s')) && (!this->HasUser(user))) @@ -883,11 +885,15 @@ void Channel::UserList(User *user, CUList *ulist) std::string prefixlist = this->GetPrefixChar(i->first); std::string nick = i->first->nick; - FOREACH_MOD(I_OnNamesListItem, OnNamesListItem(user, i->first, this, prefixlist, nick)); - /* Nick was nuked, a module wants us to skip it */ - if (nick.empty()) - continue; + if (call_modules) + { + FOREACH_MOD(I_OnNamesListItem, OnNamesListItem(user, i->first, this, prefixlist, nick)); + + /* Nick was nuked, a module wants us to skip it */ + if (nick.empty()) + continue; + } size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", prefixlist.c_str(), nick.c_str()); diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 3ce1b00eb..d4e5def63 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -16,7 +16,7 @@ static const char* dummy = "ON"; -/* $ModDesc: Provides aliases of commands. */ +/* $ModDesc: Provides the NAMESX (CAP multi-prefix) capability. */ class ModuleNamesX : public Module { 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) |