|
|
@ -8754,6 +8754,23 @@ lua_server_gc (lua_State *L) |
|
|
|
return lua_weak_gc (L, &lua_server_info); |
|
|
|
} |
|
|
|
|
|
|
|
static int |
|
|
|
lua_server_get_state (lua_State *L) |
|
|
|
{ |
|
|
|
struct lua_weak *wrapper = lua_weak_deref (L, &lua_server_info); |
|
|
|
struct server *server = wrapper->object; |
|
|
|
switch (server->state) |
|
|
|
{ |
|
|
|
case IRC_DISCONNECTED: lua_pushstring (L, "disconnected"); break; |
|
|
|
case IRC_CONNECTING: lua_pushstring (L, "connecting"); break; |
|
|
|
case IRC_CONNECTED: lua_pushstring (L, "connected"); break; |
|
|
|
case IRC_REGISTERED: lua_pushstring (L, "registered"); break; |
|
|
|
case IRC_CLOSING: lua_pushstring (L, "closing"); break; |
|
|
|
case IRC_HALF_CLOSED: lua_pushstring (L, "half_closed"); break; |
|
|
|
} |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
static int |
|
|
|
lua_server_send (lua_State *L) |
|
|
|
{ |
|
|
@ -8766,6 +8783,7 @@ lua_server_send (lua_State *L) |
|
|
|
static luaL_Reg lua_server_table[] = |
|
|
|
{ |
|
|
|
{ "__gc", lua_server_gc }, |
|
|
|
{ "get_state", lua_server_get_state }, |
|
|
|
{ "send", lua_server_send }, |
|
|
|
{ NULL, NULL } |
|
|
|
}; |
|
|
|