Skip to content

Commit

Permalink
mail-lua: Change mailbox#status API to varargs
Browse files Browse the repository at this point in the history
It's much easier to use this way
  • Loading branch information
cmouse committed Oct 18, 2018
1 parent 7cb88d4 commit 6104445
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plugins/mail-lua/mail-storage-lua.c
Expand Up @@ -350,7 +350,13 @@ static int lua_storage_mailbox_status(lua_State *L)
const char *const *keyword;
struct dlua_script *script = dlua_script_from_state(L);
struct mailbox *mbox = lua_check_storage_mailbox(script, 1);
enum mailbox_status_items items = luaL_checknumber(script->L, 2);
/* get items as list of parameters */
enum mailbox_status_items items = 0;

if (lua_gettop(script->L) < 2)
return luaL_error(script->L, "expecting at least 1 parameter");
for(int i = 2; i <= lua_gettop(script->L); i++)
items |= (unsigned int)luaL_checkinteger(script->L, i);

i_zero(&status);
if (mailbox_get_status(mbox, items, &status) < 0) {
Expand Down

0 comments on commit 6104445

Please sign in to comment.