From: Timo Sirainen Date: Sun, 10 Nov 2019 12:16:49 +0000 (+0200) Subject: push-notification: lua: Expose UTF8 from/to/subject X-Git-Tag: 2.3.9~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7980ca9269bd61af8f2e6b05ef2e36d30f6eea3;p=thirdparty%2Fdovecot%2Fcore.git push-notification: lua: Expose UTF8 from/to/subject Replace the existing "subject" field with UTF8 subject. Add new from_address, from_display_name, to_address and to_display_name where the *_display_names are UTF8. --- diff --git a/src/plugins/push-notification/push-notification-driver-lua.c b/src/plugins/push-notification/push-notification-driver-lua.c index 68d2b1e4de..2946a86c49 100644 --- a/src/plugins/push-notification/push-notification-driver-lua.c +++ b/src/plugins/push-notification/push-notification-driver-lua.c @@ -339,6 +339,24 @@ push_notification_lua_push_mailboxrename(const struct push_notification_txn_even lua_setfield(script->L, -2, "mailbox_old"); } +static void +push_notification_lua_push_message_ext(const struct push_notification_message_ext *ext, + struct dlua_script *script) +{ + lua_pushstring(script->L, ext->from_address); + lua_setfield(script->L, -2, "from_address"); + lua_pushstring(script->L, ext->from_display_name_utf8); + lua_setfield(script->L, -2, "from_display_name"); + + lua_pushstring(script->L, ext->to_address); + lua_setfield(script->L, -2, "to_address"); + lua_pushstring(script->L, ext->to_display_name_utf8); + lua_setfield(script->L, -2, "to_display_name"); + + lua_pushstring(script->L, ext->subject_utf8); + lua_setfield(script->L, -2, "subject"); +} + static void push_notification_lua_push_messageappend(const struct push_notification_txn_event *event, struct dlua_script *script) @@ -357,9 +375,6 @@ push_notification_lua_push_messageappend(const struct push_notification_txn_even lua_pushstring(script->L, data->to); lua_setfield(script->L, -2, "to"); - lua_pushstring(script->L, data->subject); - lua_setfield(script->L, -2, "subject"); - lua_pushstring(script->L, data->snippet); lua_setfield(script->L, -2, "snippet"); @@ -371,6 +386,8 @@ push_notification_lua_push_messageappend(const struct push_notification_txn_even lua_pushstring(script->L, data->message_id); lua_setfield(script->L, -2, "message_id"); + + push_notification_lua_push_message_ext(&data->ext, script); } static void @@ -391,9 +408,6 @@ push_notification_lua_push_messagenew(const struct push_notification_txn_event * lua_pushstring(script->L, data->to); lua_setfield(script->L, -2, "to"); - lua_pushstring(script->L, data->subject); - lua_setfield(script->L, -2, "subject"); - lua_pushstring(script->L, data->snippet); lua_setfield(script->L, -2, "snippet"); @@ -405,6 +419,8 @@ push_notification_lua_push_messagenew(const struct push_notification_txn_event * lua_pushstring(script->L, data->message_id); lua_setfield(script->L, -2, "message_id"); + + push_notification_lua_push_message_ext(&data->ext, script); } /* events that need special treatment */