From 4c16b692f3ae28b40e134d94105d806beba9317e Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Mon, 11 Oct 2010 14:12:52 -0400 Subject: [PATCH] Add channel::disabledmodes. This replaces use_invex, use_except, and use_forward, although those options are still used internally and will continue to work for users, to maintain config compatibility between charybdis and shadowircd. --- TODO-SHADOW | 1 - doc/example.conf | 4 +- doc/reference.conf | 34 ++++-------- include/s_conf.h | 1 + src/newconf.c | 1 + src/s_conf.c | 128 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 141 insertions(+), 28 deletions(-) diff --git a/TODO-SHADOW b/TODO-SHADOW index de20254..7d2e73e 100644 --- a/TODO-SHADOW +++ b/TODO-SHADOW @@ -1,6 +1,5 @@ Todo list for ShadowIRCd 6.2 ---------------------------- -* modesetize umodes * global/remote SET, via shared block flag. * on the fly dnsbl exceptions (?) * evaluate snotes and possibly make a lot more netwide. diff --git a/doc/example.conf b/doc/example.conf index cba5676..803b5e7 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -372,15 +372,13 @@ exempt { }; channel { + #disabledmodes = "ME"; autochanmodes = "nt"; admin_on_channel_create = no; exemptchanops = "NT"; use_halfop = yes; use_admin = yes; - use_invex = yes; - use_except = yes; use_knock = yes; - use_forward = yes; use_local_channels = yes; knock_delay = 5 minutes; knock_delay_channel = 1 minute; diff --git a/doc/reference.conf b/doc/reference.conf index 4a6cea5..6b17503 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -740,6 +740,16 @@ exempt { /* The channel block contains options pertaining to channels */ channel { + /* disabledmodes: Modes that will be disabled, users will not be + * able to set them. This is only read on startup, you need to + * restart the ircd for this to have any effect. This only prevents + * local users/opers from setting these modes. This does not prevent + * remote servers/users (ex: services) from setting them. Make sure + * your services and remote servers are properly configured when + * using this option! + */ + #disabledmodes = "ME"; + /* autochanmodes: Modes that will be set on a unregistered channel * when the first user joins it. */ @@ -776,30 +786,6 @@ channel { */ use_admin = yes; - /* invex: Enable/disable channel mode +I, a n!u@h list of masks - * that can join a +i channel without an invite. Disabling this option - * via rehash will leave all previously set invexes hanging around, - * though they will not do anything. For this reason, you may want to - * restart to disable this option. - */ - use_invex = yes; - - /* except: Enable/disable channel mode +e, a n!u@h list of masks - * that can join a channel through a ban (+b). Disabling this option - * via rehash will leave all previously set excepts hanging around, - * though they will not do anything. For this reason, you may want to - * restart to disable this option. - */ - use_except = yes; - - /* forward: Enable/disable channel mode +f, which allows you to set - * a channel to forward users to if they can't join because of +i etc. - * Disabling this option via rehash will leave all previously set - * forwards hanging around, though they will not do anything. For - * this reason, you may want to restart to disable this option. - */ - use_forward = yes; - /* knock: Allows users to request an invite to a channel that * is locked somehow (+ikl). If the channel is +p or you are banned * the knock will not be sent. diff --git a/include/s_conf.h b/include/s_conf.h index e754070..ab4a71d 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -239,6 +239,7 @@ struct config_channel_entry { char * autochanmodes; char * exemptchanops; + char * disabledmodes; int admin_on_channel_create; int use_halfop; int use_admin; diff --git a/src/newconf.c b/src/newconf.c index 40ef4ec..761e518 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -2265,6 +2265,7 @@ static struct ConfEntry conf_channel_table[] = { { "autochanmodes", CF_QSTRING, NULL, 0, &ConfigChannel.autochanmodes }, { "exemptchanops", CF_QSTRING, NULL, 0, &ConfigChannel.exemptchanops }, + { "disabledmodes", CF_QSTRING, NULL, 0, &ConfigChannel.disabledmodes }, { "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count }, { "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count }, { "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho }, diff --git a/src/s_conf.c b/src/s_conf.c index 9d525ab..1f3e742 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -51,6 +51,7 @@ #include "sslproc.h" #include "bandbi.h" #include "operhash.h" +#include "chmode.h" struct config_server_hide ConfigServerHide; @@ -85,6 +86,8 @@ extern char yytext[]; static int verify_access(struct Client *client_p, const char *username); static int attach_iline(struct Client *, struct ConfItem *); +int startup = 1; + void init_s_conf(void) { @@ -764,6 +767,7 @@ set_default_conf(void) ConfigChannel.autochanmodes = rb_strdup("nt"); ConfigChannel.exemptchanops = rb_strdup(""); + ConfigChannel.disabledmodes = rb_strdup(""); ConfigChannel.admin_on_channel_create = NO; ConfigChannel.use_halfop = YES; ConfigChannel.use_admin = YES; @@ -940,6 +944,130 @@ validate_conf(void) if(*ech == 'K') ConfigChannel.exempt_cmode_K = 1; } + + /* orphan any modes specified in channel::disabledmodes */ + char * dm; + + if(startup && !EmptyString(ConfigChannel.disabledmodes)) + { + for(dm = ConfigChannel.disabledmodes; *dm; dm++) + { + if(*dm == 'C') + { + cflag_orphan('C'); + continue; + } + if(*dm == 'r') + { + cflag_orphan('r'); + continue; + } + if(*dm == 'c') + { + cflag_orphan('c'); + continue; + } + if(*dm == 'L') + { + cflag_orphan('L'); + continue; + } + if(*dm == 'P') + { + cflag_orphan('P'); + continue; + } + if(*dm == 'z') + { + cflag_orphan('z'); + continue; + } + if(*dm == 'g') + { + cflag_orphan('g'); + continue; + } + if(*dm == 'F') + { + cflag_orphan('F'); + continue; + } + if(*dm == 'Q') + { + cflag_orphan('Q'); + continue; + } + if(*dm == 'q') + { + cflag_orphan('q'); + continue; + } + if(*dm == 'I') + { + cflag_orphan('I'); + ConfigChannel.use_invex = "NO"; + continue; + } + if(*dm == 'e') + { + cflag_orphan('e'); + ConfigChannel.use_except = "NO"; + continue; + } + if(*dm == 'f') + { + cflag_orphan('f'); + ConfigChannel.use_forward = "NO"; + continue; + } + if(*dm == 'j') + { + cflag_orphan('j'); + continue; + } + if(*dm == 'T') + { + cflag_orphan('T'); + continue; + } + if(*dm == 'D') + { + cflag_orphan('D'); + continue; + } + if(*dm == 'E') + { + cflag_orphan('E'); + continue; + } + if(*dm == 'N') + { + cflag_orphan('N'); + continue; + } + if(*dm == 'G') + { + cflag_orphan('G'); + continue; + } + if(*dm == 'J') + { + cflag_orphan('J'); + continue; + } + if(*dm == 'K') + { + cflag_orphan('K'); + continue; + } + if(*dm == 'M') + { + cflag_orphan('M'); + continue; + } + } + } + startup = 0; } /* add_temp_kline()