We're currently using the OX push driver, which is straight forward (simple web hook) and allows to store (multiple) push tokens of our webmailer direct in mailbox metadata. Only drawback is that it only supports new arriving mails in the INBOX, even mails moved via Sieve to other folders are NOT reported. Therefore we updated now to Dovecot 2.3(.10.1) to also get mails moved by user or Sieve scripts, deleted mails or flag changes. As far as I read the example Lua scripts and (a little) the Dovecot C code, the nice indirection of using mailbox metadata to a) enable push and b) store push tokens (modify reported user attribute with them) does NOT exist in the Lua driver by default. So my questions is: how can I access mailbox metadata from within the Lua script, to make eg. the example script behave like the OX driver with user_from_metadata set? I'm happy to update the Lua examples, if that's any help ... Ralf -- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Gesch?ftsf?hrer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: OpenPGP digital signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20200803/277c204d/attachment.sig>
> On 03/08/2020 12:31 Ralf Becker <rb at egroupware.org> wrote: > > > We're currently using the OX push driver, which is straight forward > (simple web hook) and allows to store (multiple) push tokens of our > webmailer direct in mailbox metadata. > > Only drawback is that it only supports new arriving mails in the INBOX, > even mails moved via Sieve to other folders are NOT reported. > > Therefore we updated now to Dovecot 2.3(.10.1) to also get mails moved > by user or Sieve scripts, deleted mails or flag changes. > > As far as I read the example Lua scripts and (a little) the Dovecot C > code, the nice indirection of using mailbox metadata to a) enable push > and b) store push tokens (modify reported user attribute with them) does > NOT exist in the Lua driver by default. > > So my questions is: how can I access mailbox metadata from within the > Lua script, to make eg. the example script behave like the OX driver > with user_from_metadata set? > > I'm happy to update the Lua examples, if that's any help ... > > Ralf > > -- > Ralf Becker > EGroupware GmbH [www.egroupware.org] > Handelsregister HRB Kaiserslautern 3587 > Gesch?ftsf?hrer Birgit und Ralf Becker > Leibnizstr. 17, 67663 Kaiserslautern, Germany > Telefon +49 631 31657-0Actually it does exist: https://doc.dovecot.org/admin_manual/lua/#mail_user.metadata_get or https://doc.dovecot.org/admin_manual/lua/#object-mailbox mailbox:metadata_get() You get both of these objects from the push notification data, you just have to keep them in the context state. (See the example scripts) function dovecot_lua_notify_begin_txn(user) local meta = user:metadata_get("/private/key") return {messages={}, ep=user:plugin_getenv("push_lua_url"), username=user.username, meta=meta} end Aki
Thanks Aki, I'll check it out :) Am 03.08.20 um 11:40 schrieb Aki Tuomi:>> On 03/08/2020 12:31 Ralf Becker <rb at egroupware.org> wrote: >> >> >> We're currently using the OX push driver, which is straight forward >> (simple web hook) and allows to store (multiple) push tokens of our >> webmailer direct in mailbox metadata. >> >> Only drawback is that it only supports new arriving mails in the INBOX, >> even mails moved via Sieve to other folders are NOT reported. >> >> Therefore we updated now to Dovecot 2.3(.10.1) to also get mails moved >> by user or Sieve scripts, deleted mails or flag changes. >> >> As far as I read the example Lua scripts and (a little) the Dovecot C >> code, the nice indirection of using mailbox metadata to a) enable push >> and b) store push tokens (modify reported user attribute with them) does >> NOT exist in the Lua driver by default. >> >> So my questions is: how can I access mailbox metadata from within the >> Lua script, to make eg. the example script behave like the OX driver >> with user_from_metadata set? >> >> I'm happy to update the Lua examples, if that's any help ... >> >> Ralf >> >> -- >> Ralf Becker >> EGroupware GmbH [www.egroupware.org] >> Handelsregister HRB Kaiserslautern 3587 >> Gesch?ftsf?hrer Birgit und Ralf Becker >> Leibnizstr. 17, 67663 Kaiserslautern, Germany >> Telefon +49 631 31657-0 > Actually it does exist: > > https://doc.dovecot.org/admin_manual/lua/#mail_user.metadata_get > > or > > https://doc.dovecot.org/admin_manual/lua/#object-mailbox > > mailbox:metadata_get() > > You get both of these objects from the push notification data, you just have to keep them in the context state. (See the example scripts) > > function dovecot_lua_notify_begin_txn(user) > local meta = user:metadata_get("/private/key") > return {messages={}, ep=user:plugin_getenv("push_lua_url"), username=user.username, meta=meta} > end > > Aki-- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Gesch?ftsf?hrer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: OpenPGP digital signature URL: <https://dovecot.org/pipermail/dovecot/attachments/20200803/1cff792c/attachment-0001.sig>