]> 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 2140a37aea1ae9919f841bbcbd23ad39ff5de95d..8211b356493da3107b195729a93cfab2f41a13d4 100644 (file)
@@ -26,7 +26,7 @@ Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : Serv
 
        (*(ServerInstance->chanlist))[cname.c_str()] = this;
        strlcpy(this->name, cname.c_str(), CHANMAX);
-       this->created = ts ? ts : ServerInstance->Time(true);
+       this->created = ts ? ts : ServerInstance->Time();
        this->age = this->created;
 
 
@@ -267,7 +267,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
                if (!IS_LOCAL(user))
                {
                        if (!TS)
-                               Instance->Log(DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn);
+                               Instance->Logs->Log("CHANNEL",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn);
                }
                else
                {
@@ -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;