Commit Diff


commit - b55915c1fe289c42a5e2ceb505f4f3c0a59f1c10
commit + e907816380d02f913cc1f9c463f7835fc70fc0c0
blob - 5cd24128fe1e5449ad8ef258887ff24c80a2112d
blob + 386aaa2a1ad7f5166a31490746b822356e32f56c
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
@@ -17,7 +17,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: channel.c,v 1.36 2002/12/13 17:22:57 alex Exp $";
+static char UNUSED id[] = "$Id: channel.c,v 1.37 2002/12/14 13:21:56 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -293,14 +293,13 @@ Channel_MemberCount( CHANNEL *Chan )
 
 
 GLOBAL INT
-Channel_CountForUser( CHANNEL *Chan, CLIENT *Client )
+Channel_CountForUser( CLIENT *Client )
 {
 	/* Count number of channels a user is member of. */
 
 	CL2CHAN *cl2chan;
 	INT count;
 	
-	assert( Chan != NULL );
 	assert( Client != NULL );
 	
 	count = 0;
@@ -313,8 +312,27 @@ Channel_CountForUser( CHANNEL *Chan, CLIENT *Client )
 
 	return count;
 } /* Channel_CountForUser */
+
+
+GLOBAL INT
+Channel_PCount( VOID )
+{
+	/* Count the number of persistent (mode 'P') channels */
+
+	CHANNEL *chan;
+	INT count;
 
+	count = 0;
+	chan = My_Channels;
+	while( chan )
+	{
+		if( strchr( chan->modes, 'P' )) count++;
+		chan = chan->next;
+	}
 
+	return count;
+} /* Channel_PCount */
+
 
 GLOBAL CHAR *
 Channel_Name( CHANNEL *Chan )
blob - f2ef35e1673c701744c7f7de7b73a0f1160b0fe9
blob + 18957d7b93d88378024d1d3f34a35df5bee917f2
--- src/ngircd/channel.h
+++ src/ngircd/channel.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: channel.h,v 1.24 2002/12/13 17:22:57 alex Exp $
+ * $Id: channel.h,v 1.25 2002/12/14 13:21:56 alex Exp $
  *
  * Channel management (header)
  */
@@ -60,7 +60,8 @@ GLOBAL VOID Channel_Kick PARAMS((  CLIENT *Client, CLI
 
 GLOBAL LONG Channel_Count PARAMS(( VOID ));
 GLOBAL LONG Channel_MemberCount PARAMS(( CHANNEL *Chan ));
-GLOBAL INT Channel_CountForUser PARAMS(( CHANNEL *Chan, CLIENT *Client ));
+GLOBAL INT Channel_CountForUser PARAMS(( CLIENT *Client ));
+GLOBAL INT Channel_PCount PARAMS(( VOID ));
 
 GLOBAL CHAR *Channel_Name PARAMS(( CHANNEL *Chan ));
 GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan ));