Hi Trever,
Please copy the mailing list too.
On Mon, 2007-05-07 at 09:45 -0600, Trever L. Adams wrote:
- Why on line 350 of your code do you say "do (almost) everything"? What is left out? Is it done still by dovcecot?
I don't remember. You can probably find out by comparing the code.
- "I decided that hardlinking into special folders was too much work (especially with removing the mails again!), so for now my plugin is calling the dspam client directly." What exactly was the problem? Can't the problem be as simple as:
a) unlink the message from inappropriate folder (if moving into spam, unlink from unlearn, if moving out unlink from learn) using the file name below b) link the message to the appropriate folder with the name of <MESSAGE ID>-
Why do a without seeing if the file exists, well, if you use the full message ID, because if people are following the rules with their MTA's and/or mail clients, then message ID should be unique as it must be unique on their system and it seems that all of them append the hose name at the end, making it globally unique (or most likely so...). If this is the case, then the client name. If this is in question then make it <MESSAGE ID><DATE><FROM>. That should make it globally unique.
This keeps one from having to mess with keeping lists. If people keep dragging the same message to their outbox from sent, then the MESSAGE ID may not be unique, but it will fit all of the same messages, hence I think it isn't a problem. Also, unlink will cause the os to traverse the directory, why should we do it as well as it will be a non-fatal error if it doesn't exist.
If you take my suggestions, and I am not just being stupid, please provide some example processes/cron jobs to go with your code in the top comments.
Actually, the thing we care about is the dspam signature which is unique. So that's not a problem.
The point is that you have to (a) when no files exist: move into spam: create a file <sig> with contents "spam" move out of spam: create a file <sig> with contents "notspam" (b) when <sig> file exists with contents "spam": move into spam: shouldn't happen move out of spam: unlink file (c) when <sig> file exists with contents "notspam": move into spam: unlink file move out of spam: shouldn't happen
the cron job would have to iterate through all these files and call dspam depending on the contents of the file.
And then it all has to be atomic.
It's not really all that complex, but I was too lazy to implement it.
johannes