end
```
+You can also make users automatically join a channel on connect with:
+`autojoin["#chan"] = true`
+
Channel state changes are logged in `chanlog.txt`, in a format similar to IRC
protocol. Lines are prefixed with `$123`, which indicates the unix timestamp for
when the action has occured.
```
IPv4 and IPv6 must be specified separately.
-With `--autojoin \#ircmoment` clients will automatically join the `#ircmoment`
-channel. This option can be specified multiple times.
-
The server hostname can be set via `--hostname`. The default is the machine's
actual hostname
--- /dev/null
+-- Copyright (c) 2026 Egor
+-- SPDX-License-Identifier: GPL-2.0-or-later
+if not autojoin then
+ autojoin = {}
+end
+hook_add("newuser", "autojoin", function(hook, cl1, cl2, chan, txt)
+ for k in pairs(autojoin) do
+ channel_join(cl1, k, false)
+ end
+end)
--- Copyright (c) 2023-2025 Egor
+-- Copyright (c) 2023-2026 Egor
-- SPDX-License-Identifier: GPL-2.0-or-later
function commands.reload(client, source, command, args)
client_notice(client, "reloading...")
dofile(getluafile "irccloud.lua")
dofile(getluafile "ctcp.lua")
dofile(getluafile "spam.lua")
+dofile(getluafile "autojoin.lua")
pcall(dofile, getluafile "local.lua")
return map_push(L, &client_map, MAPTYPE_CLIENT), 1;
if (!strcmp(key, "channel_map"))
return map_push(L, &channel_map, MAPTYPE_CHANNEL), 1;
- if (!strcmp(key, "autojoin"))
- return map_push(L, &autojoin, MAPTYPE_STRINGSET), 1;
if (!strcmp(key, "clients")) {
*(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = clients;
luaL_setmetatable(L, "client");
std::vector<char> databuf;
clientmap client_map = {};
channelmap channel_map = {};
-stringset autojoin = {};
const char *hostname = 0;
void sendbuf(Client *client) {
rpl_umodeis(client), sendbuf(client);
sendMOTD(client);
admin_hook("newuser", client, 0, 0, 0);
- for (auto key : autojoin)
- channel_join(client, key, NULL);
}
void sendLUSERS(Client *client)
{
return fprintf(stderr, "no TLS support\n"), 1;
listeners.push_back(create_listen_sock(argv[i+1], argv[i+2], is_tls ? tls_ctx : 0));
i += 2;
- } else if(!strcmp(argv[i], "--autojoin")) {
- if (i + 1 >= argc)
- return fprintf(stderr, "not enough parameters\n"), 1;
- autojoin.add(argv[i+1]);
- i += 1;
} else if(!strcmp(argv[i], "--datadir")) {
if (i + 1 >= argc)
return fprintf(stderr, "not enough parameters\n"), 1;
channel_kill(chan);
client_map.clear();
channel_map.clear();
- autojoin.clear();
if (fchanlog)
fclose(fchanlog);
return 0;