I’ve been looking at the way the FSM is handling the responses for the IMAP server for quite some time. In many cases it works wonderfully, but there are some cases that it does not do what is needed for RFC compliance.
The primary case of this is when two or more clients are connected to the same mailbox and/or when new mail is delivered to a mailbox that is selected. The second of those two scenarios is more important, but the first is a main design feature that I have always intended for the server.
The solution seems to be to create a mailbox server that handles the responses and potentially handles all interaction with the mailbox as well. This will allow for the IMAP server to keep a queue of messages for individual clients so that they will be able to receive all of the message that they are interested in and potentially reduce the access to the message store as well.
The most notable feature that is required of an IMAP server that I cannot implement with the current design in the NOOP commands ability to send untagged messages with status updates. When a mailbox has an event that changes the status of a message or the mailbox I have no real way to collecting the responses and delivering them to all of the clients that may be interested.
While I have known about this problem for a while, it has now become a large enough issue that I need to reconsider this part of the design before moving forward. I’ve been making notes on the limitation of the IMAP server in it’s current configuration and I think I’m going to take a bit of time to redesign some areas of the server and implement the mailbox / response server to take care of many of these issues.
I most likely and going to redesign some of the record I’ve been using and find better ways to handle the UID and UIDVALIDITY features in the IMAP server while I am working on this problem. All of these things need to be addressed at some point and I think taking care of them now will help the server int he long run. (or this could all be a way that I can avoid working on the FETCH command)