]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
push-notification-driver-lua: Move event push earlier
authorAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 25 Sep 2018 11:08:59 +0000 (14:08 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 12:01:53 +0000 (14:01 +0200)
Simplifies code

src/plugins/push-notification/push-notification-driver-lua.c

index 418b21d097258147e793310d1f77803323ff4cb3..ae21a1fb037f855e940cadcb16a63ea3bea0c44f 100644 (file)
@@ -365,8 +365,9 @@ push_notification_driver_lua_call(struct dlua_push_notification_context *ctx,
        lua_rawgeti(ctx->script->L, LUA_REGISTRYINDEX, tctx->tx_ref);
 
        /* push event + common fields */
+       push_notification_driver_lua_pushevent(event, ctx);
+
        if (mbox != NULL) {
-               push_notification_driver_lua_pushevent(event, ctx);
                lua_pushstring(ctx->script->L, mbox->mailbox);
                lua_setfield(ctx->script->L, -2, "mailbox");
                push_notification_driver_debug(DLUA_LOG_LABEL, user,
@@ -374,7 +375,6 @@ push_notification_driver_lua_call(struct dlua_push_notification_context *ctx,
                                               fn, event->event->event->name,
                                               mbox->mailbox);
        } else if (msg != NULL) {
-               push_notification_driver_lua_pushevent(event, ctx);
                lua_pushstring(ctx->script->L, msg->mailbox);
                lua_setfield(ctx->script->L, -2, "mailbox");
                lua_pushnumber(ctx->script->L, msg->uid);