How to access mailbox metadata in Lua push driver
Aki Tuomi
aki.tuomi at open-xchange.com
Tue Aug 4 12:55:54 EEST 2020
> On 03/08/2020 22:58 Ralf Becker <rb at egroupware.org> wrote:
>
>
> Some answers to my questions, a first version of my script and more questions ;)
>
> Am 03.08.20 um 18:15 schrieb Ralf Becker:
> > Currently looking into the following questions:
> >
> >
> > - can I get the rfc 5423 type of event somehow (obviously I can set it on the event myself depending of the function called)
> event.name
>
> > - looking at the example code, it looks like it can be called for multiple messages, when does that happen (LMTP send more then one)
> >
> still no idea, maybe Ake?
> I noticed that some events have the same uid-validity, are the from a single transaction, eg. I delete my Trash?
>
Because these events also apply for more than just LMTP. You could be storing bunch of mails with IMAP APPEND.
> > - why is the mailbox status put into an other structure and send with a different notifiction
The LUA code very faitfully implements the C API for push notifications in Dovecot.
> > - does anyone have a code snippet to send a JSON encoded message (probably easy 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 read an email:
> {"event":"FlagsClear","flags":[],"folder":"INBOX/eGroupWare/calconnect","imap-uid":2275,"imap-uidvalidity":1499767470,"keywords-old":[],"user":"user=5::42;***"}
> {"event":"FlagsSet","flags":["\\Seen"],"folder":"INBOX/eGroupWare/calconnect","imap-uid":2275,"imap-uidvalidity":1499767470,"user":"user=5::42;***"}
> {"event":"MessageRead","folder":"INBOX/eGroupWare/calconnect","imap-uid":2275,"imap-uidvalidity":1499767470,"unseen":0,"user":"user=5::42;***"}
>
This is what happens when you read unseen mail.
> Ralf
>
>
> --
> Ralf Becker
> EGroupware GmbH [www.egroupware.org (http://www.egroupware.org)]
> Handelsregister HRB Kaiserslautern 3587
> Geschäftsführer Birgit und Ralf Becker
> Leibnizstr. 17, 67663 Kaiserslautern, Germany
> Telefon +49 631 31657-0
>
Aki
More information about the dovecot
mailing list