Hi,
Yeah, you shouldn't do the erasing directly in expunge(), because it may still be aborted. Do it in sync_notify() like quota plugin does.
On 12.2.2012, at 16.52, Alex Baule wrote:
I want to know because i have header and body splited. To erase the body, i must have shure, that header was expunged. Some tests that i made, the client call expunge, but i don't know why (there is notting in mail log) the header was not expunged, nut my body was, because i call it before expunge the header. something like this.
if (found_body){ erase_body(); super.expunge(_mail); }
Because that expunge that no happen, (the client call, but the email was not expunged) i think to do like this way:
if (found_body){ super.expunge(_mail); if(_mail was expunged){ erase_body(); } }
TKs Timo !
Em 12 de fevereiro de 2012 02:19, Timo Sirainen tss@iki.fi escreveu:
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.