Mercurial > dovecot > core
changeset 26671:12597369b73e
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.
author | Timo Sirainen <timo.sirainen@open-xchange.com> |
---|---|
date | Sun, 10 Nov 2019 14:16:49 +0200 |
parents | b12ab2c247af |
children | 877b7d270ff6 |
files | src/plugins/push-notification/push-notification-driver-lua.c |
diffstat | 1 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/push-notification/push-notification-driver-lua.c Sun Nov 10 14:09:18 2019 +0200 +++ b/src/plugins/push-notification/push-notification-driver-lua.c Sun Nov 10 14:16:49 2019 +0200 @@ -340,6 +340,24 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 */