mronge/MailCore — pull request #49 by NZKoz (2012-10-03 00:12:07+00:00)
Title: Access to unread messages

I'm submitting this more as an request for comment than as something I actually want to see included in its current state.

We need to quickly retrieve all the unread messages for a folder and the existing methods didn't really make that possible (unless I've missed something). If there's another way of doing this, let me know, otherwise what we wanted was:

>>>>>>> send >>>>>>
4 UID SEARCH UNSEEN
>>>>>>> end send >>>>>>
<<<<<<< read <<<<<<
* SEARCH 43 44 46 47 301 545 546 548 549 550 551 552 553 554 606
4 OK Search completed (0.000 secs).
<<<<<<< end read <<<<<<

After that we fetch the size, and envelope:

5 UID FETCH 43,552,551,550,546,47,46,545,554,553,549,606,301,44 (UID FLAGS RFC822.SIZE ENVELOPE BODY.PEEK[HEADER.FIELDS (References)])

This is a rather clumsy implementation of the MailCore changes required to implement this functionality, if you could give me some feedback on the implementation strategy and coding style I'll happily update it for inclusion.