Added autojoin-on-connect (with auth::autojoin config option).
This commit is contained in:
parent
930629c5f2
commit
fa72cee166
|
@ -169,6 +169,12 @@ auth {
|
||||||
*/
|
*/
|
||||||
spoof = "I.still.hate.packets";
|
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:
|
/* Possible flags in auth:
|
||||||
*
|
*
|
||||||
* encrypted | password is encrypted with mkpasswd
|
* encrypted | password is encrypted with mkpasswd
|
||||||
|
|
|
@ -324,6 +324,12 @@ auth {
|
||||||
*/
|
*/
|
||||||
spoof = "I.still.hate.packets";
|
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:
|
/* Possible flags in auth:
|
||||||
*
|
*
|
||||||
* encrypted | password is encrypted with mkpasswd
|
* encrypted | password is encrypted with mkpasswd
|
||||||
|
|
|
@ -64,6 +64,7 @@ struct ConfItem
|
||||||
char *host; /* host part of user@host */
|
char *host; /* host part of user@host */
|
||||||
char *passwd; /* doubles as kline reason *ugh* */
|
char *passwd; /* doubles as kline reason *ugh* */
|
||||||
char *spasswd; /* Password to send. */
|
char *spasswd; /* Password to send. */
|
||||||
|
char *autojoin; /* channels for users to autojoin to on connect */
|
||||||
char *user; /* user part of user@host */
|
char *user; /* user part of user@host */
|
||||||
int port;
|
int port;
|
||||||
time_t hold; /* Hold action until this time (calendar time) */
|
time_t hold; /* Hold action until this time (calendar time) */
|
||||||
|
|
|
@ -1017,6 +1017,15 @@ conf_set_auth_passwd(void *data)
|
||||||
yy_aconf->passwd = rb_strdup(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
|
static void
|
||||||
conf_set_auth_spoof(void *data)
|
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 },
|
{ "password", CF_QSTRING, conf_set_auth_passwd, 0, NULL },
|
||||||
{ "class", CF_QSTRING, conf_set_auth_class, 0, NULL },
|
{ "class", CF_QSTRING, conf_set_auth_class, 0, NULL },
|
||||||
{ "spoof", CF_QSTRING, conf_set_auth_spoof, 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 },
|
{ "redirserv", CF_QSTRING, conf_set_auth_redir_serv, 0, NULL },
|
||||||
{ "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL },
|
{ "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL },
|
||||||
{ "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL },
|
{ "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL },
|
||||||
|
|
12
src/s_user.c
12
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_umode_changed hdata;
|
||||||
hook_data_client hdata2;
|
hook_data_client hdata2;
|
||||||
char sockhost[HOSTLEN];
|
char sockhost[HOSTLEN];
|
||||||
|
struct ConfItem *aconf;
|
||||||
|
|
||||||
if(MyClient(source_p))
|
if(MyClient(source_p))
|
||||||
send_umode(source_p, source_p, 0, 0, ubuf);
|
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;
|
hdata2.target = source_p;
|
||||||
call_hook(h_introduce_client, &hdata2);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue