From d7a3d23cdd4b9f2b3e87d6c11e847c57acd9018f Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Thu, 29 Jul 2010 14:22:33 -0400 Subject: [PATCH] Add channel::admin_on_channel_create, which gives users creating new channels +ao instead of +o, if enabled. --- doc/example.conf | 1 + doc/reference.conf | 5 +++++ include/s_conf.h | 1 + modules/m_info.c | 6 ++++++ src/channel.c | 5 ++++- src/newconf.c | 1 + src/s_conf.c | 1 + 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/example.conf b/doc/example.conf index f730b83..2bc25de 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -377,6 +377,7 @@ exempt { channel { autochanmodes = "nt"; + admin_on_channel_create = no; exemptchanops = "NT"; use_halfop = yes; use_admin = yes; diff --git a/doc/reference.conf b/doc/reference.conf index 0c21b38..6d6f2ce 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -770,6 +770,11 @@ channel { */ autochanmodes = "nt"; + /* admin_on_channel_create: If set to yes, users joining new channels + * will be given +ao instead of just +o. Requires use_admin. + */ + admin_on_channel_create = no; + /* exemptchanops: Channel modes that any form of channel ops (+aoh) * will be exempt from. Even if the mode is set, it will not apply to the * channel ops if it is listed in this option. Valid modes are cCDTNGK. diff --git a/include/s_conf.h b/include/s_conf.h index ec3a222..d8a7fcb 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -239,6 +239,7 @@ struct config_channel_entry { char * autochanmodes; char * exemptchanops; + int admin_on_channel_create; int use_halfop; int use_admin; int use_except; diff --git a/modules/m_info.c b/modules/m_info.c index 1491180..c8ab7de 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -625,6 +625,12 @@ static struct InfoStruct info_table[] = { &ConfigChannel.host_in_topic, "Defines whether a topicsetters host or just nick is shown on TOPIC", }, + { + "admin_on_channel_create", + OUTPUT_BOOLEAN_YN, + &ConfigChannel.admin_on_channel_create, + "Give users +ao on channel create", + }, { "use_halfop", OUTPUT_BOOLEAN_YN, diff --git a/src/channel.c b/src/channel.c index 9c95fb7..3e47278 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1873,7 +1873,10 @@ void user_join(struct Client * client_p, struct Client * source_p, const char * continue; } - flags = CHFL_CHANOP; + if(ConfigChannel.admin_on_channel_create) + flags = CHFL_ADMIN | CHFL_CHANOP; + else + flags = CHFL_CHANOP; } if((rb_dlink_list_length(&source_p->user->channel) >= diff --git a/src/newconf.c b/src/newconf.c index df662d8..6071fa9 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -2279,6 +2279,7 @@ static struct ConfEntry conf_channel_table[] = { "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels }, { "cycle_host_change", CF_YESNO, NULL, 0, &ConfigChannel.cycle_host_change }, { "host_in_topic", CF_YESNO, NULL, 0, &ConfigChannel.host_in_topic }, + { "admin_on_channel_create", CF_YESNO, NULL, 0, &ConfigChannel.admin_on_channel_create }, { "use_halfop", CF_YESNO, NULL, 0, &ConfigChannel.use_halfop }, { "use_admin", CF_YESNO, NULL, 0, &ConfigChannel.use_admin }, { "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except }, diff --git a/src/s_conf.c b/src/s_conf.c index f54dc80..045c3c2 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -764,6 +764,7 @@ set_default_conf(void) ConfigChannel.autochanmodes = rb_strdup("nt"); ConfigChannel.exemptchanops = rb_strdup(""); + ConfigChannel.admin_on_channel_create = NO; ConfigChannel.use_halfop = YES; ConfigChannel.use_admin = YES; ConfigChannel.use_except = YES;