]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-info.c
LUSERS reply: only count "visible" channels
[ngircd-alex.git] / src / ngircd / irc-info.c
index 736412f1fcdde91459540de1b51df995b2003e70..01192570f53c988bbe1d464304ddc31214f3e526 100644 (file)
@@ -480,7 +480,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
        COMMAND *cmd;
        time_t time_now;
        unsigned int days, hrs, mins;
-       struct list_head list;
+       struct list_head *list;
        struct list_elem *list_item;
 
        assert(Client != NULL);
@@ -531,7 +531,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
                        list = Class_GetList(CLASS_GLINE);
                else
                        list = Class_GetList(CLASS_KLINE);
-                       list_item = Lists_GetFirst(&list);
+                       list_item = Lists_GetFirst(list);
                        while (list_item) {
                                if (!IRC_WriteStrClient(from, RPL_STATSXLINE_MSG,
                                                Client_ID(from), query,
@@ -1277,38 +1277,55 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
 } /* IRC_WHOWAS */
 
 
+/**
+ * Send LUSERS reply to a client.
+ *
+ * @param Client The receipient of the information.
+ * @return CONNECTED or DISCONNECTED.
+ */
 GLOBAL bool
-IRC_Send_LUSERS( CLIENT *Client )
+IRC_Send_LUSERS(CLIENT *Client)
 {
        unsigned long cnt;
 #ifndef STRICT_RFC
        unsigned long max;
 #endif
 
-       assert( Client != NULL );
+       assert(Client != NULL);
 
        /* Users, services and serevers in the network */
-       if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
+       if (!IRC_WriteStrClient(Client, RPL_LUSERCLIENT_MSG, Client_ID(Client),
+                               Client_UserCount(), Client_ServiceCount(),
+                               Client_ServerCount()))
+               return DISCONNECTED;
 
        /* Number of IRC operators */
        cnt = Client_OperCount( );
-       if( cnt > 0 )
-       {
-               if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
+       if (cnt > 0) {
+               if (!IRC_WriteStrClient(Client, RPL_LUSEROP_MSG,
+                                       Client_ID(Client), cnt))
+                       return DISCONNECTED;
        }
 
        /* Unknown connections */
        cnt = Client_UnknownCount( );
-       if( cnt > 0 )
-       {
-               if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
+       if (cnt > 0) {
+               if (!IRC_WriteStrClient(Client, RPL_LUSERUNKNOWN_MSG,
+                                       Client_ID(Client), cnt))
+                       return DISCONNECTED;
        }
 
        /* Number of created channels */
-       if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
+       if (!IRC_WriteStrClient(Client, RPL_LUSERCHANNELS_MSG,
+                               Client_ID(Client),
+                               Channel_CountVisible(Client)))
+               return DISCONNECTED;
 
        /* Number of local users, services and servers */
-       if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
+       if (!IRC_WriteStrClient(Client, RPL_LUSERME_MSG, Client_ID(Client),
+                               Client_MyUserCount(), Client_MyServiceCount(),
+                               Client_MyServerCount()))
+               return DISCONNECTED;
 
 #ifndef STRICT_RFC
        /* Maximum number of local users */