#include "../nick/nick.h"
#include "../channel/channel.h"
-int lua_channelmessage(channel *cp, char *message, ...);
-int lua_message(nick *np, char *message, ...);
-int lua_notice(nick *np, char *message, ...);
+int lua_channelmessage(channel *cp, char *message, ...) __attribute__ ((format (printf, 2, 3)));
+int lua_message(nick *np, char *message, ...) __attribute__ ((format (printf, 2, 3)));
+int lua_notice(nick *np, char *message, ...) __attribute__ ((format (printf, 2, 3)));
int _lua_vpcall(lua_State *l, void *function, int mode, const char *sig, ...);
char *printallmodes(channel *cp);
-nick *lua_nick;
+extern nick *lua_nick;
+extern sstring *luabotnick;
#define LUA_OK 0
#define LUA_FAIL 1
#define LUA_TPUSHNUMBER(l, param, value) { lua_pushstring(l, param); lua_pushnumber(l, value); lua_rawset(l, -3); }
#define LUA_TPUSHBOOLEAN(l, param, value) { lua_pushstring(l, param); lua_pushboolean(l, value); lua_rawset(l, -3); }
-#define LUA_PUSHNICK(l, np) { lua_newtable(l); LUA_TPUSHSTRING(l, "nick", np->nick); LUA_TPUSHSTRING(l, "ident", np->ident); LUA_TPUSHSTRING(l, "hostname", np->host->name->content); LUA_TPUSHSTRING(l, "realname", np->realname->name->content); LUA_TPUSHSTRING(l, "account", np->authname); LUA_TPUSHNUMBER(l, "numeric", np->numeric); LUA_TPUSHSTRING(l, "ip", IPtostr(np->p_ipaddr)); }
+#define LUA_PUSHNICK(l, np) { lua_newtable(l); LUA_TPUSHSTRING(l, "nick", np->nick); LUA_TPUSHSTRING(l, "ident", np->ident); LUA_TPUSHSTRING(l, "hostname", np->host->name->content); LUA_TPUSHSTRING(l, "realname", np->realname->name->content); LUA_TPUSHSTRING(l, "account", np->authname); LUA_TPUSHNUMBER(l, "numeric", np->numeric); LUA_TPUSHSTRING(l, "ip", IPtostr(np->ipaddress)); }
#define LUA_PUSHCHAN(l, cp) { lua_newtable(l); LUA_TPUSHNUMBER(l, "timestamp", cp->timestamp); LUA_TPUSHNUMBER(l, "totalusers", cp->users->totalusers); if(cp->topic) { LUA_TPUSHSTRING(l, "topic", cp->topic->content); }; LUA_TPUSHSTRING(l, "modes", printallmodes(cp)); }