function commands.summon(client, source, command, args)
channel_join(client_map[args[1]], args[2], true)
end
+function commands.refreshctcp()
+ 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")
+ 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")
+ end
+ end
+end
if not spamlevel then
spamlevel = 0
}
return 0;
}
+static int fn_client_privmsg(lua_State *L)
+{
+ extern const char *hostname;
+ struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
+ const char *msg = luaL_checkstring(L, 2);
+ msg_privmsg_server(luaL_optstring(L, 3, hostname), cl->nick, msg), sendbuf(cl);
+ return 0;
+}
static int fn_client_notice(lua_State *L)
{
extern const char *hostname;
struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
const char *msg = luaL_checkstring(L, 2);
- msg_notice_server(hostname, cl->nick, msg), sendbuf(cl);
+ msg_notice_server(luaL_optstring(L, 3, hostname), cl->nick, msg), sendbuf(cl);
return 0;
}
static int fn_channel_join(lua_State *L)
lua_setglobal(L, "commands");
lua_newtable(L);
lua_setglobal(L, "hooks");
+ lua_pushcfunction(L, fn_client_privmsg);
+ lua_setglobal(L, "client_privmsg");
lua_pushcfunction(L, fn_client_notice);
lua_setglobal(L, "client_notice");
lua_pushcfunction(L, fn_channel_join);