wyleyr/afew — pull request #1 by wyleyr (2014-01-01 18:12:50+00:00)
Title: MailMover: Handle multiple copies of messages 

I've modified MailMover.move to deal with a few issues I had getting it to work with my Gmail-via-IMAP setup:

1. Fixed: catch and ignore error when a copy of the message already exists at the destination (e.g., moving a message from INBOX to Archive)
1. Fixed: when multiple copies of a message exist, move only deletes exactly the copy that resides in the maildir to which a move rule applies (this did not work before...the move would delete whatever copy of the message was indicated by message.get_filename())
1. Added: ability to move a message to multiple folders (desirable, since folders represent Gmail labels in my setup)

The first two issues are bugs I ran into as I tried to get MailMover to work with my mail setup, which contains multiple copies of most messages.

The third issue is a side-effect of how I solved the first two: my version changes the way messages are moved. Multiple rules now can now be applied to a message in a given source maildir; each rule will copy the messge to a destination maildir, and then the original will be deleted when all copies have been made. (I have also changed the documentation to reflect this.) For my setup, this is the behavior I want, but I don't know if it's the way MailMover.move should work in general. Maybe the right thing to do instead would be to implement this behavior in a subclass?

P.S. This is my first github pull request, so please let me know if I've done it wrong or you need more information!