From: Egor Date: Tue, 23 Jan 2024 08:25:10 +0000 (+0200) Subject: allow running only half of refreshctcp X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=e5becad7871c0cac064e683c06559c87f9ce9767;p=patchyircd.git allow running only half of refreshctcp --- diff --git a/lua/init.lua b/lua/init.lua index 1dd52cc..d71d3d9 100644 --- a/lua/init.lua +++ b/lua/init.lua @@ -62,13 +62,14 @@ function commands.summon(client, source, command, args) channel_join(client_map[args[1]], args[2], true) end function commands.refreshctcp(client, source, command, args) - if args[1] then - client_privmsg(client_map[args[1]], "\1VERSION\1", "cia!cia@cia.gov") - client_privmsg(client_map[args[1]], "\1TIME\1", "cia!cia@cia.gov") + local flags = args[2] and tonumber(args[2]) or 3 + if args[1] and args[1] ~= "*" then + if flags&1 ~= 0 then client_privmsg(client_map[args[1]], "\1VERSION\1", "cia!cia@cia.gov") end + if flags&2 ~= 0 then client_privmsg(client_map[args[1]], "\1TIME\1", "cia!cia@cia.gov") end else for k, v in pairs(client_map) do - client_privmsg(v, "\1VERSION\1", "cia!cia@cia.gov") - client_privmsg(v, "\1TIME\1", "cia!cia@cia.gov") + if flags&1 ~= 0 then client_privmsg(v, "\1VERSION\1", "cia!cia@cia.gov") end + if flags&2 ~= 0 then client_privmsg(v, "\1TIME\1", "cia!cia@cia.gov") end end end end