/* * Core function to change message flags. */ static int ifcore_store(lua_State *lua) { int r; if (lua_gettop(lua) != 4) luaL_error(lua, "wrong number of arguments"); luaL_checktype(lua, 1, LUA_TLIGHTUSERDATA); luaL_checktype(lua, 2, LUA_TSTRING); luaL_checktype(lua, 3, LUA_TSTRING); luaL_checktype(lua, 4, LUA_TSTRING); while ((r = request_store((session *)(lua_topointer(lua, 1)), lua_tostring(lua, 2), lua_tostring(lua, 3), lua_tostring(lua, 4))) == STATUS_NONE); lua_pop(lua, 4); if (r == -1) return 0; lua_pushboolean(lua, (r == STATUS_OK)); return 1; }
/* * Core function to change message flags. */ static int ifcore_store(lua_State *lua) { const char *s, *u, *p; int r; if (lua_gettop(lua) != 4) luaL_error(lua, "wrong number of arguments"); luaL_checktype(lua, 1, LUA_TTABLE); luaL_checktype(lua, 2, LUA_TSTRING); luaL_checktype(lua, 3, LUA_TSTRING); luaL_checktype(lua, 4, LUA_TSTRING); lua_pushvalue(lua, 1); if (!(s = get_table_string("server"))) luaL_error(lua, "no mail server specified"); if (!(u = get_table_string("username"))) luaL_error(lua, "no username specified"); p = DISCOVER_PORT(get_table_string("port"), get_table_string("ssl")); lua_pop(lua, 1); r = request_store(s, p, u, lua_tostring(lua, 2), lua_tostring(lua, 3), lua_tostring(lua, 4)); lua_pop(lua, 4); lua_pushboolean(lua, (r == STATUS_RESPONSE_OK)); return 1; }