commit - b932baab5240d80512406e660efece151add0d9d
commit + f11b01ccc2c9aa8b20c607da10d7e60dab36efaf
blob - f02c535d94ccd0fa7e44a7c8d798953df3176e4e
blob + c9011468f3ec7b985cefedd26134ea609ce30b69
--- doc/sample-ngircd.conf.tmpl
+++ doc/sample-ngircd.conf.tmpl
;ConnectIPv6 = yes
;ConnectIPv4 = yes
+ # Default channel mode(s) to set on new channels. Default: none.
+ ;DefaultChannelModes = n
+
# Default user mode(s) to set on new local clients. Please note that
# only modes can be set that the client could set using regular MODE
# commands, you can't set "a" (away) for example! Default: none.
blob - d0d73f77181d0e86bead2c7d908f1731ec9c7458
blob + a65f581ea8c0d6b75b0aee8c7d9d96fc0412c3ae
--- man/ngircd.conf.5.tmpl
+++ man/ngircd.conf.5.tmpl
the IPv6 protocol.
Default: yes.
.TP
+\fBDefaultChannelModes\fR (string)
+Default channel mode(s) to set on new channels.
+Default: none.
+.TP
\fBDefaultUserModes\fR (string)
Default user mode(s) to set on new local clients. Please note that only modes
can be set that the client could set using regular MODE commands, you can't
blob - 6cf4fe038c88c57c129271e610787b538aa25442
blob + 35fa60b10f484763732520a6b4ae4409231ee8de
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6));
printf(" ConnectIPv6 = %s\n", yesno_to_str(Conf_ConnectIPv4));
#endif
+ printf(" DefaultChannelModes = %s\n", Conf_DefaultChannelModes);
printf(" DefaultUserModes = %s\n", Conf_DefaultUserModes);
printf(" DNS = %s\n", yesno_to_str(Conf_DNS));
#ifdef IDENTAUTH
#else
Conf_ConnectIPv6 = false;
#endif
+ strcpy(Conf_DefaultChannelModes, "");
strcpy(Conf_DefaultUserModes, "");
Conf_DNS = true;
#ifdef IDENTAUTH
Conf_ConnectIPv4 = Check_ArgIsTrue(Arg);
return;
}
+ if (strcasecmp(Var, "DefaultChannelModes") == 0) {
+ p = Arg;
+ Conf_DefaultChannelModes[0] = '\0';
+ while (*p) {
+ if (strchr(Conf_DefaultChannelModes, *p)) {
+ /* Mode is already included; ignore it */
+ p++;
+ continue;
+ }
+
+ if (strchr(CHANMODES, *p)) {
+ len = strlen(Conf_DefaultChannelModes) + 1;
+ assert(len < sizeof(Conf_DefaultChannelModes));
+ Conf_DefaultChannelModes[len - 1] = *p;
+ Conf_DefaultChannelModes[len] = '\0';
+ } else {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Unknown channel mode \"%c\" in \"DefaultChannelModes\"!",
+ File, Line, *p);
+ }
+ p++;
+ }
+ return;
+ }
if (strcasecmp(Var, "DefaultUserModes") == 0) {
p = Arg;
Conf_DefaultUserModes[0] = '\0';
blob - 9378d17c35f9c27436f6c885c141aed68fbbcbed
blob + 010568291309a7dfc36d8c23c32ff77a39e78ed2
--- src/ngircd/conf.h
+++ src/ngircd/conf.h
/** Disable all CTCP commands except for /me ? */
GLOBAL bool Conf_ScrubCTCP;
+/** Default channel modes for new channels */
+GLOBAL char Conf_DefaultChannelModes[CHANNEL_MODE_LEN];
+
/** Default user modes for new local clients */
GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
blob - a1bb4ef597f930387ede37c4a3d8d007b8fe19e1
blob + cc34601c660e9e82bd84e74d2486716064220517
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
GLOBAL bool
IRC_JOIN( CLIENT *Client, REQUEST *Req )
{
- char *channame, *key = NULL, *flags, *lastkey = NULL, *lastchan = NULL;
+ char *channame, *key = NULL, *flags, *lastkey = NULL, *lastchan = NULL, *p;
CLIENT *target;
CHANNEL *chan;
if (!chan) { /* channel is new; it has been created above */
chan = Channel_Search(channame);
assert(chan != NULL);
+
+ /* Set default channel modes */
+ p = Conf_DefaultChannelModes;
+ while (*p) {
+ Channel_ModeAdd(chan, *p);
+ p++;
+ }
+
if (Channel_IsModeless(chan)) {
Channel_ModeAdd(chan, 't'); /* /TOPIC not allowed */
Channel_ModeAdd(chan, 'n'); /* no external msgs */