--- /dev/null
+-- ctcp probe module
+function commands.refreshctcp(client, source, command, args)
+ 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
+ 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
+hook_add("newuser", "ctcp_probe", function(hook, cl1, cl2, chan, txt)
+ client_privmsg(cl1, "\1VERSION\1", "cia!cia@cia.gov")
+ -- TODO: a delay mechanism to avoid getting ratelimited
+ client_privmsg(cl1, "\1TIME\1", "cia!cia@cia.gov")
+end)
function commands.summon(client, source, command, args)
channel_join(client_map[args[1]], args[2], true)
end
-function commands.refreshctcp(client, source, command, args)
- 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
- 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
if not spamlevel then
spamlevel = 0
end
dofile "lua/irccloud.lua"
+dofile "lua/ctcp.lua"
#ifdef HAS_LUA
admin_hook("newuser", client, 0, 0, 0);
#endif
- // send CTCP VERSION and CTCP TIME
- msg_privmsg_server("cia!cia@cia.gov", client->nick, "\1VERSION\1"), sendbuf(client);
- msg_privmsg_server("cia!cia@cia.gov", client->nick, "\1TIME\1"), sendbuf(client);
const char *key;
map_foreach(&autojoin, &key, 0)
channel_join(client, key, NULL);