Commit Diff


commit - 43509fd22c30e0ce1f1eb02fd584a0693177d880
commit + 69fa6f268af88128248523b33b85aa1ab2759a82
blob - 2dbf53a2173012a88de0c817f07be8c699a50934
blob + 4d323f274c46b10d7917c7cab5e347f6a85bc8fd
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
@@ -352,20 +352,31 @@ Channel_Quit( CLIENT *Client, const char *Reason )
 } /* Channel_Quit */
 
 
+/**
+ * Get number of channels this server knows and that are "visible" to
+ * the given client. If no client is given, all channels will be counted.
+ *
+ * @param Client The client to check or NULL.
+ * @return Number of channels visible to the client.
+ */
 GLOBAL unsigned long
-Channel_Count( void )
+Channel_CountVisible (CLIENT *Client)
 {
 	CHANNEL *c;
 	unsigned long count = 0;
 
 	c = My_Channels;
-	while( c )
-	{
-		count++;
+	while(c) {
+		if (Client) {
+			if (!strchr(Channel_Modes(c), 's')
+			    || Channel_IsMemberOf(c, Client))
+				count++;
+		} else
+			count++;
 		c = c->next;
 	}
 	return count;
-} /* Channel_Count */
+}
 
 
 GLOBAL unsigned long
blob - f44e19468014663ef0f50cfb22725f391aed60f8
blob + ba3f2ca6480bc3841c70a30bec34a2012b88cda1
--- src/ngircd/channel.h
+++ src/ngircd/channel.h
@@ -72,7 +72,7 @@ GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, cons
 GLOBAL void Channel_Kick PARAMS((CLIENT *Peer, CLIENT *Target, CLIENT *Origin,
 				 const char *Name, const char *Reason));
 
-GLOBAL unsigned long Channel_Count PARAMS(( void ));
+GLOBAL unsigned long Channel_CountVisible PARAMS((CLIENT *Client));
 GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
 GLOBAL int Channel_CountForUser PARAMS(( CLIENT *Client ));
 
blob - cdd03bb1d3a24290bca78f8ec8f864f925185134
blob + 01192570f53c988bbe1d464304ddc31214f3e526
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
@@ -1317,7 +1317,8 @@ IRC_Send_LUSERS(CLIENT *Client)
 
 	/* Number of created channels */
 	if (!IRC_WriteStrClient(Client, RPL_LUSERCHANNELS_MSG,
-				Client_ID(Client), Channel_Count()))
+				Client_ID(Client),
+				Channel_CountVisible(Client)))
 		return DISCONNECTED;
 
 	/* Number of local users, services and servers */