diff --git a/doc/example.conf b/doc/example.conf index 01faf8f..1fc042d 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -175,6 +175,11 @@ auth { */ autojoin = "#shadowircd,#test"; + /* autojoin_opers : Channel (or channels, comma-seperated) to join + * opers to on oper-up. + */ + autojoin_opers = "#opers,#help"; + /* Possible flags in auth: * * encrypted | password is encrypted with mkpasswd diff --git a/doc/reference.conf b/doc/reference.conf index c0dff6e..4efb054 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -330,6 +330,11 @@ auth { */ autojoin = "#shadowircd,#test"; + /* autojoin_opers : Channel (or channels, comma-seperated) to join + * opers to on oper-up. + */ + autojoin_opers = "#opers,#help"; + /* Possible flags in auth: * * encrypted | password is encrypted with mkpasswd diff --git a/include/s_conf.h b/include/s_conf.h index 65337bc..70c755c 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -65,6 +65,7 @@ struct ConfItem char *passwd; /* doubles as kline reason *ugh* */ char *spasswd; /* Password to send. */ char *autojoin; /* channels for users to autojoin to on connect */ + char *autojoin_opers; /* channels for opers to autojoin on oper-up */ char *user; /* user part of user@host */ int port; time_t hold; /* Hold action until this time (calendar time) */ diff --git a/src/newconf.c b/src/newconf.c index a168a08..8b93cf8 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -1026,6 +1026,15 @@ conf_set_auth_autojoin(void *data) yy_aconf->autojoin = rb_strdup(data); } +static void +conf_set_auth_autojoin_opers(void *data) +{ + if(yy_aconf->autojoin_opers) + memset(yy_aconf->autojoin_opers, 0, strlen(yy_aconf->autojoin)); + rb_free(yy_aconf->autojoin_opers); + yy_aconf->autojoin_opers = rb_strdup(data); +} + static void conf_set_auth_spoof(void *data) { @@ -2093,6 +2102,7 @@ static struct ConfEntry conf_auth_table[] = { "class", CF_QSTRING, conf_set_auth_class, 0, NULL }, { "spoof", CF_QSTRING, conf_set_auth_spoof, 0, NULL }, { "autojoin", CF_QSTRING, conf_set_auth_autojoin, 0, NULL }, + { "autojoin_opers", CF_QSTRING, conf_set_auth_autojoin_opers, 0, NULL }, { "redirserv", CF_QSTRING, conf_set_auth_redir_serv, 0, NULL }, { "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL }, { "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL }, diff --git a/src/s_user.c b/src/s_user.c index e4f81a5..23c569b 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -1293,6 +1293,7 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p) { unsigned int old = source_p->umodes, oldsnomask = source_p->snomask; hook_data_umode_changed hdata; + struct ConfItem *aconf; SetOper(source_p); @@ -1354,6 +1355,18 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p) sendto_one_notice(source_p, ":*** Oper privs are %s", oper_p->privset->privs); send_oper_motd(source_p); + aconf = source_p->localClient->att_conf; + + /* Do the auth::autojoin_opers wizardry here */ + if(aconf->autojoin_opers != NULL) + { + /* opers should never be banned from the opers channel. + * Plus this is post-umode being set so you'll pass +I $o or +O. + * Hence why we're making this a normal clean join. --jdhore + */ + user_join(client_p, source_p, aconf->autojoin_opers, NULL, 0); + } + return (1); }