repo: ngircd
action: commit
revision: 
path_from: 
revision_from: e907816380d02f913cc1f9c463f7835fc70fc0c0:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit e907816380d02f913cc1f9c463f7835fc70fc0c0
Author: Alexander Barton 
Date:   Sat Dec 14 13:21:56 2002 +0000

    - fixed up Channel_PCount() and Channel_CountForUser().

diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
index 5cd24128fe1e5449ad8ef258887ff24c80a2112d..
index ..386aaa2a1ad7f5166a31490746b822356e32f56c 100644
--- a/src/ngircd/channel.c
+++ b/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 
@@ -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;
@@ -315,6 +314,25 @@ Channel_CountForUser( CHANNEL *Chan, CLIENT *Client )
 } /* 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 )
diff --git a/src/ngircd/channel.h b/src/ngircd/channel.h
index f2ef35e1673c701744c7f7de7b73a0f1160b0fe9..
index ..18957d7b93d88378024d1d3f34a35df5bee917f2 100644
--- a/src/ngircd/channel.h
+++ b/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, CLIENT *Origin, CHAR *Name, C

 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 ));

-----END OF PAGE-----