Added autojoin-on-connect (with auth::autojoin config option).

This commit is contained in:
JD Horelick 2010-02-23 00:22:37 -05:00
parent 930629c5f2
commit fa72cee166
5 changed files with 35 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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