Add oper autojoin (with auth::autojoin_opers config option).

This commit is contained in:
JD Horelick 2010-02-23 00:41:14 -05:00
parent fa72cee166
commit 87f58b4ffb
5 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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) */

View File

@ -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 },

View File

@ -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);
}