Alex Baule
2012-Feb-10 17:39 UTC
[Dovecot] There is a way to know if a email has been expunged ?
Hy Everyone...and Timo ! There is a way to know if a email was expunged (deleted from hard disk) inside a plugin ? I rewrite the expunge function, but the real expunge function is void, i can't know if was really expunged. There is a way to know this ?
Timo Sirainen
2012-Feb-12 04:19 UTC
[Dovecot] There is a way to know if a email has been expunged ?
On 10.2.2012, at 19.39, Alex Baule wrote:> Hy Everyone...and Timo ! > > There is a way to know if a email was expunged (deleted from hard > disk) inside a plugin ? I rewrite the expunge function, but the real > expunge function is void, i can't know if was really expunged. > > There is a way to know this ?It's not known until transaction_commit() what messages are expunged. What do you need to know this for? There are a few different ways. If you simply need one of the sessions to definitely know that it expunged a message, you can do it like quota plugin does. (So even if there are multiple clients doing EXPUNGE at the same time, quota is never decreased more than once per mail.) See quota-storage.c and most importantly quota_mailbox_sync_notify(). Quota code also shows the other method of doing it: keep track of what mail_expunge()s have been called, and then in transaction commit check if it succeeds and if it does do what you want to do.