diff --git a/doc/example.conf b/doc/example.conf index 6a79129..01faf8f 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -169,6 +169,12 @@ auth { */ spoof = "I.still.hate.packets"; + /* autojoin: Channel (or channels, comma-seperated) to join users + * in this auth block to on connect. Note that this won't join + * the user through any bans or otherwise restrictive chmodes. + */ + autojoin = "#shadowircd,#test"; + /* Possible flags in auth: * * encrypted | password is encrypted with mkpasswd diff --git a/doc/reference.conf b/doc/reference.conf index 10971d4..c0dff6e 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -324,6 +324,12 @@ auth { */ spoof = "I.still.hate.packets"; + /* autojoin: Channel (or channels, comma-seperated) to join users + * in this auth block to on connect. Note that this won't join + * the user through any bans or otherwise restrictive chmodes. + */ + autojoin = "#shadowircd,#test"; + /* Possible flags in auth: * * encrypted | password is encrypted with mkpasswd diff --git a/include/s_conf.h b/include/s_conf.h index 3f9d167..65337bc 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -64,6 +64,7 @@ struct ConfItem char *host; /* host part of user@host */ char *passwd; /* doubles as kline reason *ugh* */ char *spasswd; /* Password to send. */ + char *autojoin; /* channels for users to autojoin to on connect */ 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 ab564cd..a168a08 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -1017,6 +1017,15 @@ conf_set_auth_passwd(void *data) yy_aconf->passwd = rb_strdup(data); } +static void +conf_set_auth_autojoin(void *data) +{ + if(yy_aconf->autojoin) + memset(yy_aconf->autojoin, 0, strlen(yy_aconf->autojoin)); + rb_free(yy_aconf->autojoin); + yy_aconf->autojoin = rb_strdup(data); +} + static void conf_set_auth_spoof(void *data) { @@ -2083,6 +2092,7 @@ static struct ConfEntry conf_auth_table[] = { "password", CF_QSTRING, conf_set_auth_passwd, 0, NULL }, { "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 }, { "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 ce94bd8..e4f81a5 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -591,6 +591,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User * hook_data_umode_changed hdata; hook_data_client hdata2; char sockhost[HOSTLEN]; + struct ConfItem *aconf; if(MyClient(source_p)) send_umode(source_p, source_p, 0, 0, ubuf); @@ -703,6 +704,17 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User * hdata2.target = source_p; call_hook(h_introduce_client, &hdata2); + /* Do all the auth::autojoin wizardry once we're connected */ + if(MyConnect(source_p)) + { + aconf = source_p->localClient->att_conf; + + if(aconf->autojoin != NULL) + { + user_join(client_p, source_p, aconf->autojoin, NULL, 0); + } + } + return 0; }