1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-01 02:56:37 +02:00

Specifying multiple channels ("#one,#two") in set::auto-join,

set::oper-auto-join or tld::channel was broken. It worked for the
very first user since boot or rehash, but after that only the
first channel was joined. Reported by PeGaSuS in
https://bugs.unrealircd.org/view.php?id=5535
This commit is contained in:
Bram Matthys
2020-01-20 15:41:12 +01:00
parent f3019f89a1
commit d30f7e006d
2 changed files with 17 additions and 10 deletions
+12 -7
View File
@@ -1114,24 +1114,29 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
/* Force the user to join the given chans -- codemastr */
tlds = find_tld(client);
if (tlds && !BadPtr(tlds->channel)) {
char *chans[3] = {
if (tlds && !BadPtr(tlds->channel))
{
char *chans = strdup(tlds->channel);
char *args[3] = {
client->name,
tlds->channel,
chans,
NULL
};
do_cmd(client, NULL, "JOIN", 3, chans);
do_cmd(client, NULL, "JOIN", 3, args);
safe_free(chans);
if (IsDead(client))
return 0;
}
else if (!BadPtr(AUTO_JOIN_CHANS) && strcmp(AUTO_JOIN_CHANS, "0"))
{
char *chans[3] = {
char *chans = strdup(AUTO_JOIN_CHANS);
char *args[3] = {
client->name,
AUTO_JOIN_CHANS,
chans,
NULL
};
do_cmd(client, NULL, "JOIN", 3, chans);
do_cmd(client, NULL, "JOIN", 3, args);
safe_free(chans);
if (IsDead(client))
return 0;
}
+5 -3
View File
@@ -299,12 +299,14 @@ CMD_FUNC(cmd_oper)
if (!BadPtr(OPER_AUTO_JOIN_CHANS) && strcmp(OPER_AUTO_JOIN_CHANS, "0"))
{
char *chans[3] = {
char *chans = strdup(OPER_AUTO_JOIN_CHANS);
char *args[3] = {
client->name,
OPER_AUTO_JOIN_CHANS,
chans,
NULL
};
do_cmd(client, NULL, "JOIN", 3, chans);
do_cmd(client, NULL, "JOIN", 3, args);
safe_free(chans);
/* Theoretically the oper may be killed on join. Would be fun, though */
if (IsDead(client))
return;