mail-lua.c (dovecot-2.3.16) | : | mail-lua.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
void dlua_push_mail(lua_State *L, struct mail *mail) | void dlua_push_mail(lua_State *L, struct mail *mail) | |||
{ | { | |||
luaL_checkstack(L, 20, "out of memory"); | luaL_checkstack(L, 20, "out of memory"); | |||
/* create a table for holding few things */ | /* create a table for holding few things */ | |||
lua_createtable(L, 0, 20); | lua_createtable(L, 0, 20); | |||
luaL_setmetatable(L, LUA_STORAGE_MAIL); | luaL_setmetatable(L, LUA_STORAGE_MAIL); | |||
lua_pushlightuserdata(L, mail); | lua_pushlightuserdata(L, mail); | |||
lua_setfield(L, -2, "item"); | lua_setfield(L, -2, "item"); | |||
#undef LUA_TABLE_SETNUMBER | #undef LUA_TABLE_SET_NUMBER | |||
#define LUA_TABLE_SETNUMBER(field) \ | #define LUA_TABLE_SET_NUMBER(field) \ | |||
lua_pushnumber(L, mail->field); \ | lua_pushnumber(L, mail->field); \ | |||
lua_setfield(L, -2, #field); | lua_setfield(L, -2, #field); | |||
#undef LUA_TABLE_SETBOOL | #undef LUA_TABLE_SET_BOOL | |||
#define LUA_TABLE_SETBOOL(field) \ | #define LUA_TABLE_SET_BOOL(field) \ | |||
lua_pushboolean(L, mail->field); \ | lua_pushboolean(L, mail->field); \ | |||
lua_setfield(L, -2, #field); | lua_setfield(L, -2, #field); | |||
LUA_TABLE_SETNUMBER(seq); | LUA_TABLE_SET_NUMBER(seq); | |||
LUA_TABLE_SETNUMBER(uid); | LUA_TABLE_SET_NUMBER(uid); | |||
LUA_TABLE_SETBOOL(expunged); | LUA_TABLE_SET_BOOL(expunged); | |||
dlua_push_mailbox(L, mail->box); | dlua_push_mailbox(L, mail->box); | |||
lua_setfield(L, -2, "mailbox"); | lua_setfield(L, -2, "mailbox"); | |||
} | } | |||
static struct mail * | static struct mail * | |||
lua_check_storage_mail(lua_State *L, int arg) | lua_check_storage_mail(lua_State *L, int arg) | |||
{ | { | |||
if (!lua_istable(L, arg)) { | if (!lua_istable(L, arg)) { | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added |