1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-01-15 18:15:40 +00:00

- fixed up Channel_PCount() and Channel_CountForUser().

This commit is contained in:
Alexander Barton 2002-12-14 13:21:56 +00:00
parent b55915c1fe
commit e907816380
2 changed files with 24 additions and 5 deletions

View File

@ -17,7 +17,7 @@
#include "portab.h" #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 "imp.h"
#include <assert.h> #include <assert.h>
@ -293,14 +293,13 @@ Channel_MemberCount( CHANNEL *Chan )
GLOBAL INT GLOBAL INT
Channel_CountForUser( CHANNEL *Chan, CLIENT *Client ) Channel_CountForUser( CLIENT *Client )
{ {
/* Count number of channels a user is member of. */ /* Count number of channels a user is member of. */
CL2CHAN *cl2chan; CL2CHAN *cl2chan;
INT count; INT count;
assert( Chan != NULL );
assert( Client != NULL ); assert( Client != NULL );
count = 0; count = 0;
@ -315,6 +314,25 @@ Channel_CountForUser( CHANNEL *Chan, CLIENT *Client )
} /* Channel_CountForUser */ } /* 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 * GLOBAL CHAR *
Channel_Name( CHANNEL *Chan ) Channel_Name( CHANNEL *Chan )

View File

@ -8,7 +8,7 @@
* (at your option) any later version. * (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information. * 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) * 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_Count PARAMS(( VOID ));
GLOBAL LONG Channel_MemberCount PARAMS(( CHANNEL *Chan )); 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_Name PARAMS(( CHANNEL *Chan ));
GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan )); GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan ));