]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_safelist.cpp
AMD64 warning 'fix' which tested fine when I added it seems to now...stop things...
[user/henk/code/inspircd.git] / src / modules / m_safelist.cpp
index debacaaebe12ae889e96f0632148e512d84bb935..fb5513fe25ca2cde1c73e06d9d06345d6c37049d 100644 (file)
@@ -97,13 +97,19 @@ class ListTimer : public InspTimer
                                                WriteServ(u->fd,"321 %s Channel :Users Name",u->nick);
                                         chan = Srv->GetChannelIndex(ld->list_position);
                                         /* spool details */
-                                        if ((chan) && (((!(chan->binarymodes & CM_PRIVATE)) && (!(chan->binarymodes & CM_SECRET))) || (has_channel(u,chan))))
+                                       bool has_user = (chan && chan->HasUser(u));
+                                        if ((chan) && (((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET]))) || (has_user)))
                                         {
                                                 /* Increment total plus linefeed */
-                                                int counter = snprintf(buffer,MAXBUF,"322 %s %s %d :[+%s] %s",u->nick,chan->name,usercount_i(chan),chanmodes(chan,has_channel(u,chan)),chan->topic);
-                                                amount_sent += counter + 4 + Srv->GetServerName().length();
-                                                log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
-                                                WriteServ_NoFormat(u->fd,buffer);
+                                               long users = usercount_i(chan);
+                                               /* If there are only invisible users on the channel, dont show it */
+                                               if (users)
+                                               {
+                                                       int counter = snprintf(buffer,MAXBUF,"322 %s %s %ld :[+%s] %s",u->nick,chan->name,users,chanmodes(chan,has_user),chan->topic);
+                                                       amount_sent += counter + 4 + Srv->GetServerName().length();
+                                                       log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
+                                                       WriteServ_NoFormat(u->fd,buffer);
+                                               }
                                         }
                                         else
                                         {
@@ -160,7 +166,7 @@ class ModuleSafeList : public Module
         * OnPreCommand()
         *   Intercept the LIST command.
         */ 
-       virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user, bool validated)
+       virtual int OnPreCommand(const std::string &command, char **parameters, int pcnt, userrec *user, bool validated)
        {
                /* If the command doesnt appear to be valid, we dont want to mess with it. */
                if (!validated)
@@ -249,7 +255,7 @@ class ModuleSafeList : public Module
                output.append(" SAFELIST");
        }
 
-       virtual void OnUserQuit(userrec* user, std::string message)
+       virtual void OnUserQuit(userrec* user, const std::string &message)
        {
                this->OnCleanup(TYPE_USER,user);
        }