]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Patch from nenolod
[user/henk/code/inspircd.git] / src / channels.cpp
index c90a8f4e5881d337a1ef76e720f9bf066241d47d..8211b356493da3107b195729a93cfab2f41a13d4 100644 (file)
@@ -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)))
@@ -881,9 +883,19 @@ void Channel::UserList(User *user, CUList *ulist)
                if (i->first->Visibility && !i->first->Visibility->VisibleTo(user))
                        continue;
 
-               size_t ptrlen = snprintf(ptr, MAXBUF, "%s%s ", this->GetPrefixChar(i->first), i->second.c_str());
-               /* OnUserList can change this - reset it back to normal */
-               i->second = i->first->nick;
+               std::string prefixlist = this->GetPrefixChar(i->first);
+               std::string nick = i->first->nick;
+
+               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());
 
                curlen += ptrlen;
                ptr += ptrlen;