Displaying 6 results from an estimated 6 matches for "dovecot_lua_notify_begin_txn".
2020 Aug 03
2
How to access mailbox metadata in Lua push driver
...l_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 358...
2020 Aug 03
3
How to access mailbox metadata in Lua push driver
...ox:url=<push_lua_url> user_from_metadata -- local http = require "socket.http" local ltn12 = require "ltn12" -- luarocks install json-lua local json = require "JSON" function table_get(t, k, d)
return t[k] or d end function script_init()
return 0 end function dovecot_lua_notify_begin_txn(user)
local meta = user:metadata_get("/private/vendor/vendor.dovecot/http-notify")
return {user=user, event=dovecot.event(), ep=user:plugin_getenv("push_lua_url"), messages={}, meta=meta}
end function dovecot_lua_notify_event_message_new(ctx, event)
-- check if there...
2020 Aug 03
2
How to access mailbox metadata in Lua push driver
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
2020 Aug 03
0
How to access mailbox metadata in Lua push driver
...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
2020 Aug 04
0
How to access mailbox metadata in Lua push driver
...to figure out looking at Lua docu)
> these two I managed to solve im my current version of the script, which also support now all message event types:
<snip7>
>
> This leads to a couple more questions ;)
> - is there a way (eg. return value) to stop event processing already in dovecot_lua_notify_begin_txn
There is no really good way to do this. You can error out in begin_txn, but that will emit error.
The only doable way, right now, is to maybe add key {disabled=True} to your context, and then add
if ctx.disabled:
return
elsewhere.
> - sometimes multiple events are generated, eg. when I...
2020 Aug 03
0
How to access mailbox metadata in Lua push driver
...>>
>> 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 H...