[Dovecot] Using IMAP keywords instead of mailboxes for spam with dovecot-antispam
Johannes Berg
johannes at sipsolutions.net
Thu Mar 20 16:16:10 EET 2008
Hi,
> I guess that in need_keyword_hook case save_init/save_finish hooks will
> have to check email for spams and keyword it. It is not clear how to
> mark mail as spam if both need_folder_hook and need_keyword_hook are
> true.
Well, the need_keyword_hook variable is just internal. The point is that
save_{init,finish} are not invoked when just the keywords change, so I
override the struct mail's update_keywords function.
See
http://git.sipsolutions.net/?p=dovecot-antispam.git;a=blob;f=antispam-storage-1.0.c;hb=HEAD#l265
> > One problem with this is that evolution doesn't sync the keywords to the
> > server right away, only when you change folders. Also, it's not entirely
> > obvious what the code should do when the backend fails since there
> > doesn't seem to be a way to roll back the keyword change easily. Any
> > comments on the code would be appreciated, and you can probably easily
> > make it invoke the backend with what's there to actually test it.
>
> If I understand how it works with folders -- if message is moved from/to
> spam folder and spam learning fails, dovecot-antispam rolls back the
> IMAP transaction and dovecot reports error to client? (sorry if I am
> wrong, didn't read code nor IMAP specification, just assuming).
Yes.
> Then I think it would be correct to do exactly same with keywords and
> let client handle error. I am not sure if Evolution would handle that...
The thing is that I don't know what context the update_keywords function
runs in and whether it has a transaction at all, so I don't know how to
roll back. I suppose it would be possible to grab the original keyword
list before invoking super.update_keywords() and then resetting to that
if the backend fails...
johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20080320/4b92c59c/attachment.bin
More information about the dovecot
mailing list