diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 37e4c4017..10c6517bf 100755 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -361,6 +361,7 @@ channel { resv_forcepart = yes; channel_target_change = yes; disable_local_channels = no; + autochanmodes = "+nt"; }; serverhide { diff --git a/doc/reference.conf b/doc/reference.conf index 894c284fc..6ac161717 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -794,6 +794,11 @@ channel { * supported. */ disable_local_channels = no; + + /* autochanmodes: the channel modes that should be automatically set + * when a channel is created. + */ + autochanmodes = "+nt"; }; diff --git a/include/s_conf.h b/include/s_conf.h index ec6545c45..42df6ef0d 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -258,6 +258,7 @@ struct config_channel_entry int resv_forcepart; int channel_target_change; int disable_local_channels; + unsigned int autochanmodes; }; struct config_server_hide diff --git a/modules/core/m_join.c b/modules/core/m_join.c index b18921413..b45728e3b 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -341,8 +341,7 @@ m_join(struct Client *client_p, struct Client *source_p, int parc, const char *p if(flags & CHFL_CHANOP) { chptr->channelts = rb_current_time(); - chptr->mode.mode |= MODE_TOPICLIMIT; - chptr->mode.mode |= MODE_NOPRIVMSGS; + chptr->mode.mode |= ConfigChannel.autochanmodes; modes = channel_modes(chptr, &me); sendto_channel_local(ONLY_CHANOPS, chptr, ":%s MODE %s %s", diff --git a/src/newconf.c b/src/newconf.c index b7cf43293..cf6757276 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -29,6 +29,7 @@ #include "blacklist.h" #include "sslproc.h" #include "privilege.h" +#include "chmode.h" #define CF_TYPE(x) ((x) & CF_MTYPE) @@ -1797,6 +1798,42 @@ conf_set_alias_target(void *data) yy_alias->target = rb_strdup(data); } +static void +conf_set_channel_autochanmodes(void *data) +{ + char *pm; + int what = MODE_ADD; + + ConfigChannel.autochanmodes = 0; + for (pm = (char *) data; *pm; pm++) + { + switch (*pm) + { + case '+': + what = MODE_ADD; + break; + case '-': + what = MODE_DEL; + break; + + default: + if (chmode_table[(unsigned char) *pm].set_func == chm_simple) + { + if (what == MODE_ADD) + ConfigChannel.autochanmodes |= chmode_table[(unsigned char) *pm].mode_type; + else + ConfigChannel.autochanmodes &= ~chmode_table[(unsigned char) *pm].mode_type; + } + else + { + conf_report_error("channel::autochanmodes -- Invalid channel mode %c", pm); + continue; + } + break; + } + } +} + /* XXX for below */ static void conf_set_blacklist_reason(void *data); @@ -2419,6 +2456,7 @@ static struct ConfEntry conf_channel_table[] = { "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart }, { "channel_target_change", CF_YESNO, NULL, 0, &ConfigChannel.channel_target_change }, { "disable_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.disable_local_channels }, + { "autochanmodes", CF_QSTRING, conf_set_channel_autochanmodes, 0, NULL }, { "\0", 0, NULL, 0, NULL } }; diff --git a/src/s_conf.c b/src/s_conf.c index 35c52a8b9..96559c13b 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -793,6 +793,8 @@ set_default_conf(void) ConfigChannel.channel_target_change = YES; ConfigChannel.disable_local_channels = NO; + ConfigChannel.autochanmodes = MODE_TOPICLIMIT | MODE_NOPRIVMSGS; + ConfigServerHide.flatten_links = 0; ConfigServerHide.links_delay = 300; ConfigServerHide.hidden = 0;