1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-12 18:00:28 +00:00

- New functions Channel_[Set]Key(), Channel_[Set]MaxUsers.

This commit is contained in:
Alexander Barton 2002-12-16 23:05:24 +00:00
parent 7924fafb25
commit 2e88dd72d1
2 changed files with 51 additions and 6 deletions

View File

@ -17,7 +17,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: channel.c,v 1.37 2002/12/14 13:21:56 alex Exp $"; static char UNUSED id[] = "$Id: channel.c,v 1.38 2002/12/16 23:05:24 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -350,6 +350,22 @@ Channel_Modes( CHANNEL *Chan )
} /* Channel_Modes */ } /* Channel_Modes */
GLOBAL CHAR *
Channel_Key( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->key;
} /* Channel_Key */
GLOBAL LONG
Channel_MaxUsers( CHANNEL *Chan )
{
assert( Chan != NULL );
return Chan->maxusers;
} /* Channel_MaxUsers */
GLOBAL CHANNEL * GLOBAL CHANNEL *
Channel_First( VOID ) Channel_First( VOID )
{ {
@ -629,6 +645,27 @@ Channel_SetModes( CHANNEL *Chan, CHAR *Modes )
} /* Channel_SetModes */ } /* Channel_SetModes */
GLOBAL VOID
Channel_SetKey( CHANNEL *Chan, CHAR *Key )
{
assert( Chan != NULL );
assert( Key != NULL );
strncpy( Chan->key, Key, CLIENT_PASS_LEN - 1 );
Chan->key[CLIENT_PASS_LEN - 1] = '\0';
Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
} /* Channel_SetKey */
GLOBAL VOID
Channel_SetMaxUsers( CHANNEL *Chan, LONG Count )
{
assert( Chan != NULL );
Chan->maxusers = Count;
Log( LOG_DEBUG, "Channel %s: Member limit is now %ld.", Chan->name, Chan->maxusers );
} /* Channel_SetMaxUsers */
GLOBAL BOOLEAN GLOBAL BOOLEAN
Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ) Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
@ -678,6 +715,8 @@ Channel_Create( CHAR *Name )
strcpy( c->modes, "" ); strcpy( c->modes, "" );
strcpy( c->topic, "" ); strcpy( c->topic, "" );
c->hash = Hash( c->name ); c->hash = Hash( c->name );
strcpy( c->key, "" );
c->maxusers = 0;
/* Verketten */ /* Verketten */
c->next = My_Channels; c->next = My_Channels;

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.25 2002/12/14 13:21:56 alex Exp $ * $Id: channel.h,v 1.26 2002/12/16 23:05:24 alex Exp $
* *
* Channel management (header) * Channel management (header)
*/ */
@ -25,10 +25,12 @@
typedef struct _CHANNEL typedef struct _CHANNEL
{ {
struct _CHANNEL *next; struct _CHANNEL *next;
CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */ CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */
UINT32 hash; /* Hash ueber (kleingeschrieben) Namen */ UINT32 hash; /* Hash of the (lowecase!) name */
CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */ CHAR modes[CHANNEL_MODE_LEN]; /* Channel modes */
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */ CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic of the channel */
CHAR key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
LONG maxusers; /* Maximum number of members (mode "l") */
} CHANNEL; } CHANNEL;
typedef struct _CLIENT2CHAN typedef struct _CLIENT2CHAN
@ -66,9 +68,13 @@ 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 ));
GLOBAL CHAR *Channel_Topic PARAMS(( CHANNEL *Chan )); GLOBAL CHAR *Channel_Topic PARAMS(( CHANNEL *Chan ));
GLOBAL CHAR *Channel_Key PARAMS(( CHANNEL *Chan ));
GLOBAL LONG Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
GLOBAL VOID Channel_SetTopic PARAMS(( CHANNEL *Chan, CHAR *Topic )); GLOBAL VOID Channel_SetTopic PARAMS(( CHANNEL *Chan, CHAR *Topic ));
GLOBAL VOID Channel_SetModes PARAMS(( CHANNEL *Chan, CHAR *Modes )); GLOBAL VOID Channel_SetModes PARAMS(( CHANNEL *Chan, CHAR *Modes ));
GLOBAL VOID Channel_SetKey PARAMS(( CHANNEL *Chan, CHAR *Key ));
GLOBAL VOID Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, LONG Count ));
GLOBAL CHANNEL *Channel_Search PARAMS(( CHAR *Name )); GLOBAL CHANNEL *Channel_Search PARAMS(( CHAR *Name ));