]> arthur.barton.de Git - ngircd-alex.git/commitdiff
- fixed up Channel_PCount() and Channel_CountForUser().
authorAlexander Barton <alex@barton.de>
Sat, 14 Dec 2002 13:21:56 +0000 (13:21 +0000)
committerAlexander Barton <alex@barton.de>
Sat, 14 Dec 2002 13:21:56 +0000 (13:21 +0000)
src/ngircd/channel.c
src/ngircd/channel.h

index 5cd24128fe1e5449ad8ef258887ff24c80a2112d..386aaa2a1ad7f5166a31490746b822356e32f56c 100644 (file)
@@ -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;
@@ -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 )
index f2ef35e1673c701744c7f7de7b73a0f1160b0fe9..18957d7b93d88378024d1d3f34a35df5bee917f2 100644 (file)
@@ -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 ));