From 341f971efa1d564d3a9b169be483a44d96e3c40e Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Tue, 21 Dec 2010 20:38:04 +0000 Subject: [PATCH] Bring across disable_local_channels config option from ircd-seven --- doc/example.conf | 1 + doc/reference.conf | 5 +++++ include/s_conf.h | 1 + modules/core/m_join.c | 3 ++- modules/m_info.c | 6 ++++++ src/newconf.c | 1 + src/supported.c | 11 +++++++++-- 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/doc/example.conf b/doc/example.conf index 4587ea27..615f9873 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -341,6 +341,7 @@ channel { only_ascii_channels = no; resv_forcepart = yes; channel_target_change = yes; + disable_local_channels = no; }; serverhide { diff --git a/doc/reference.conf b/doc/reference.conf index 82fe7746..fd5de7cb 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -769,6 +769,11 @@ channel { * voiced users are exempt. */ channel_target_change = yes; + + /* disable local channels: if yes, then local channels will not be + * supported. + */ + disable_local_channels = no; }; diff --git a/include/s_conf.h b/include/s_conf.h index b3e60951..df85c359 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -247,6 +247,7 @@ struct config_channel_entry int only_ascii_channels; int resv_forcepart; int channel_target_change; + int disable_local_channels; }; struct config_server_hide diff --git a/modules/core/m_join.c b/modules/core/m_join.c index 14e69a3f..c4308b07 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -166,7 +166,8 @@ m_join(struct Client *client_p, struct Client *source_p, int parc, const char *p } /* check it begins with # or &, and local chans are disabled */ - else if(!IsChannelName(name)) + else if(!IsChannelName(name) || + ( ConfigChannel.disable_local_channels && name[0] == '&')) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name); diff --git a/modules/m_info.c b/modules/m_info.c index 50fbac81..a52b272f 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -524,6 +524,12 @@ static struct InfoStruct info_table[] = { &ConfigChannel.kick_on_split_riding, "Kick users riding splits to join +i or +k channels" }, + { + "disable_local_channels", + OUTPUT_BOOLEAN_YN, + &ConfigChannel.disable_local_channels, + "Disable local channels (&channels)" + }, { "max_bans", OUTPUT_DECIMAL, diff --git a/src/newconf.c b/src/newconf.c index 7405cfd8..0f575b18 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -2210,6 +2210,7 @@ static struct ConfEntry conf_channel_table[] = { "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward }, { "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 }, { "\0", 0, NULL, 0, NULL } }; diff --git a/src/supported.c b/src/supported.c index a06b9ac8..936f4cb2 100644 --- a/src/supported.c +++ b/src/supported.c @@ -244,12 +244,19 @@ isupport_chanmodes(const void *ptr) return result; } +static const char * +isupport_chantypes(const void *ptr) +{ + return ConfigChannel.disable_local_channels ? "#" : "&#"; +} + static const char * isupport_chanlimit(const void *ptr) { static char result[30]; - rb_snprintf(result, sizeof result, "&#:%i", ConfigChannel.max_chans_per_user); + rb_snprintf(result, sizeof result, "%s:%i", + ConfigChannel.disable_local_channels ? "#" : "&#", ConfigChannel.max_chans_per_user); return result; } @@ -297,7 +304,7 @@ init_isupport(void) static int channellen = LOC_CHANNELLEN; static int topiclen = TOPICLEN; - add_isupport("CHANTYPES", isupport_string, "&#"); + add_isupport("CHANTYPES", isupport_chantypes, NULL); add_isupport("EXCEPTS", isupport_boolean, &ConfigChannel.use_except); add_isupport("INVEX", isupport_boolean, &ConfigChannel.use_invex); add_isupport("CHANMODES", isupport_chanmodes, NULL);