mailbox-lua.c (dovecot-2.3.16) | : | mailbox-lua.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 185 | skipping to change at line 185 | |||
const char *error = mailbox_get_last_error(mbox, NULL); | const char *error = mailbox_get_last_error(mbox, NULL); | |||
return luaL_error(L, "mailbox_get_status(%s, %u) failed: %s", | return luaL_error(L, "mailbox_get_status(%s, %u) failed: %s", | |||
mailbox_get_vname(mbox), items, error); | mailbox_get_vname(mbox), items, error); | |||
} | } | |||
/* returns a table */ | /* returns a table */ | |||
lua_createtable(L, 0, 20); | lua_createtable(L, 0, 20); | |||
lua_pushstring(L, mailbox_get_vname(mbox)); | lua_pushstring(L, mailbox_get_vname(mbox)); | |||
lua_setfield(L, -2, "mailbox"); | lua_setfield(L, -2, "mailbox"); | |||
#undef LUA_TABLE_SETNUMBER | #undef LUA_TABLE_SET_NUMBER | |||
#define LUA_TABLE_SETNUMBER(field) \ | #define LUA_TABLE_SET_NUMBER(field) \ | |||
lua_pushnumber(L, status.field); \ | lua_pushnumber(L, status.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, status.field); \ | lua_pushboolean(L, status.field); \ | |||
lua_setfield(L, -2, #field); | lua_setfield(L, -2, #field); | |||
LUA_TABLE_SETNUMBER(messages); | LUA_TABLE_SET_NUMBER(messages); | |||
LUA_TABLE_SETNUMBER(recent); | LUA_TABLE_SET_NUMBER(recent); | |||
LUA_TABLE_SETNUMBER(unseen); | LUA_TABLE_SET_NUMBER(unseen); | |||
LUA_TABLE_SETNUMBER(uidvalidity); | LUA_TABLE_SET_NUMBER(uidvalidity); | |||
LUA_TABLE_SETNUMBER(uidnext); | LUA_TABLE_SET_NUMBER(uidnext); | |||
LUA_TABLE_SETNUMBER(first_unseen_seq); | LUA_TABLE_SET_NUMBER(first_unseen_seq); | |||
LUA_TABLE_SETNUMBER(first_recent_uid); | LUA_TABLE_SET_NUMBER(first_recent_uid); | |||
LUA_TABLE_SETNUMBER(highest_modseq); | LUA_TABLE_SET_NUMBER(highest_modseq); | |||
LUA_TABLE_SETNUMBER(highest_pvt_modseq); | LUA_TABLE_SET_NUMBER(highest_pvt_modseq); | |||
LUA_TABLE_SETNUMBER(permanent_flags); | LUA_TABLE_SET_NUMBER(permanent_flags); | |||
LUA_TABLE_SETNUMBER(flags); | LUA_TABLE_SET_NUMBER(flags); | |||
LUA_TABLE_SETBOOL(permanent_keywords); | LUA_TABLE_SET_BOOL(permanent_keywords); | |||
LUA_TABLE_SETBOOL(allow_new_keywords); | LUA_TABLE_SET_BOOL(allow_new_keywords); | |||
LUA_TABLE_SETBOOL(nonpermanent_modseqs); | LUA_TABLE_SET_BOOL(nonpermanent_modseqs); | |||
LUA_TABLE_SETBOOL(no_modseq_tracking); | LUA_TABLE_SET_BOOL(no_modseq_tracking); | |||
LUA_TABLE_SETBOOL(have_guids); | LUA_TABLE_SET_BOOL(have_guids); | |||
LUA_TABLE_SETBOOL(have_save_guids); | LUA_TABLE_SET_BOOL(have_save_guids); | |||
LUA_TABLE_SETBOOL(have_only_guid128); | LUA_TABLE_SET_BOOL(have_only_guid128); | |||
if (status.keywords != NULL && array_is_created(status.keywords)) { | if (status.keywords != NULL && array_is_created(status.keywords)) { | |||
int i = 1; | int i = 1; | |||
lua_createtable(L, array_count(status.keywords), 0); | lua_createtable(L, array_count(status.keywords), 0); | |||
array_foreach_elem(status.keywords, keyword) { | array_foreach_elem(status.keywords, keyword) { | |||
lua_pushstring(L, keyword); | lua_pushstring(L, keyword); | |||
lua_rawseti(L, -2, i++); | lua_rawseti(L, -2, i++); | |||
} | } | |||
lua_setfield(L, -2, "keywords"); | lua_setfield(L, -2, "keywords"); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
24 lines changed or deleted | 24 lines changed or added |