commit - 82aaffe55d6ed82465517a2f93a2d9e9a92b1f28
commit + 1b852fce72a87f3cce2049fde59ab66b6bbda6ca
blob - f723e2bcf516da90ad3c99989b7d0f691b7ec00b
blob + 50257bece5784b504044a29d602d56bdb471a63f
--- ChangeLog
+++ ChangeLog
ngIRCd HEAD
+ - Predefined Channel configuration now allows specification of channel key
+ (mode k) and maximum user count (mode l).
- When using epoll() IO interface, compile in the select() interface as
well and fall back to it when epoll() isn't available on runtime.
- New configure option "--without-select" to disable select() IO API
--
-$Id: ChangeLog,v 1.312 2006/12/26 16:00:45 alex Exp $
+$Id: ChangeLog,v 1.313 2006/12/29 14:09:48 fw Exp $
blob - d5b971596822df52d61262c40669d0003a6d2712
blob + 6bed77b253cb52c689f07fbc3b2ea80897d3ac71
--- doc/sample-ngircd.conf
+++ doc/sample-ngircd.conf
-# $Id: sample-ngircd.conf,v 1.38 2006/11/05 13:03:47 fw Exp $
+# $Id: sample-ngircd.conf,v 1.39 2006/12/29 14:09:48 fw Exp $
#
# This is a sample configuration file for the ngIRCd, which must be adepted
;Topic = a great topic
# Initial channel modes
- ;Modes = tn
+ ;Modes = tnk
+ # initial channel password (mode k)
+ ;Key = Secret
+
+ # maximum users per channel (mode l)
+ ;MaxUsers = 23
+
[Channel]
# More [Channel] sections, if you like ...
blob - af32c411562701a18de5858ba68ce6572218d4ae
blob + ebdd9c956375c45c92f0e0eaa029bc414c82ffe3
--- man/ngircd.conf.5.tmpl
+++ man/ngircd.conf.5.tmpl
.\"
-.\" $Id: ngircd.conf.5.tmpl,v 1.1 2006/12/25 16:13:26 alex Exp $
+.\" $Id: ngircd.conf.5.tmpl,v 1.2 2006/12/29 14:09:49 fw Exp $
.\"
.TH ngircd.conf 5 "August 2005" ngircd "ngIRCd Manual"
.SH NAME
.TP
\fBModes\fR
Initial channel modes.
+.TP
+\fBKey\fR
+Sets initial channel key (only relevant if mode k is set)
+.TP
+\fBMaxUsers\fR
+Set maximum user limit for this channel (only relevant if mode l is set)
.SH HINTS
It's wise to use "ngircd --configtest" to validate the configuration file
after changing it. See
blob - e31b268f509da533bbe888d65e9157fd817e78da
blob + 12b287c81eccef85857a2dcee35b28d1f848b30d
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
#include "portab.h"
-static char UNUSED id[] = "$Id: channel.c,v 1.61 2006/12/07 22:23:39 fw Exp $";
+static char UNUSED id[] = "$Id: channel.c,v 1.62 2006/12/29 14:09:50 fw Exp $";
#include "imp.h"
#include <assert.h>
while (*c)
Channel_ModeAdd(chan, *c++);
+ Channel_SetKey(chan, Conf_Channel[i].key);
+ Channel_SetMaxUsers(chan, Conf_Channel[i].maxusers);
+
Log(LOG_INFO, "Created pre-defined channel \"%s\".",
Conf_Channel[i].name );
}
{
CHANNEL *c, *c_next;
CL2CHAN *cl2chan, *cl2chan_next;
-
+
/* Channel-Strukturen freigeben */
c = My_Channels;
while( c )
blob - 7390f22477104d2c1c7e2f1ccc05493abb591c7e
blob + 05750f1fc91e8feaad51635c3c2a0ab6d184cf93
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
#include "portab.h"
-static char UNUSED id[] = "$Id: conf.c,v 1.96 2006/11/20 19:32:07 fw Exp $";
+static char UNUSED id[] = "$Id: conf.c,v 1.97 2006/12/29 14:09:50 fw Exp $";
#include "imp.h"
#include <assert.h>
puts( "[CHANNEL]" );
printf( " Name = %s\n", Conf_Channel[i].name );
printf( " Modes = %s\n", Conf_Channel[i].modes );
+ printf( " Key = %s\n", Conf_Channel[i].key );
+ printf( " MaxUsers = %lu\n", Conf_Channel[i].maxusers );
topic = (char*)array_start(&Conf_Channel[i].topic);
printf( " Topic = %s\n\n", topic ? topic : "");
/* Initialize new channel structure */
strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
+ strcpy( Conf_Channel[Conf_Channel_Count].key, "" );
+ Conf_Channel[Conf_Channel_Count].maxusers = 0;
array_free(&Conf_Channel[Conf_Channel_Count].topic);
Conf_Channel_Count++;
}
/* Initial topic */
if (!array_copys( &Conf_Channel[chancount].topic, Arg))
Config_Error_TooLong( Line, Var );
+ return;
+ }
+
+ if( strcasecmp( Var, "Key" ) == 0 ) {
+ /* Initial Channel Key (mode k) */
+ len = strlcpy(Conf_Channel[chancount].key, Arg, sizeof(Conf_Channel[chancount].key));
+ if (len >= sizeof( Conf_Channel[chancount].key ))
+ Config_Error_TooLong(Line, Var);
return;
}
+ if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
+ /* maximum user limit, mode l */
+ Conf_Channel[chancount].maxusers = (unsigned long) atol(Arg);
+ if (Conf_Channel[chancount].maxusers == 0)
+ Config_Error_NaN(Line, Var);
+ return;
+ }
+
Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!",
NGIRCd_ConfFile, Line, Var );
} /* Handle_CHANNEL */
blob - bb9a00b348f6d538c2a7a4fe3a90f8e43246878c
blob + 1f21b4b52c06da42060f788e6ccd3610067cb607
--- src/ngircd/conf.h
+++ src/ngircd/conf.h
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
- * $Id: conf.h,v 1.41 2006/11/05 13:03:48 fw Exp $
+ * $Id: conf.h,v 1.42 2006/12/29 14:09:50 fw Exp $
*
* Configuration management (header)
*/
{
char name[CHANNEL_NAME_LEN]; /* Name of the channel */
char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
+ char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
+ unsigned long maxusers; /* maximum usercount for this channel, mode "l" */
array topic; /* Initial topic */
} CONF_CHANNEL;