Am I on the right track? Is imap4 lib the right tool for this job? If so, is modifying IMAP4Server to handle Deferreds the right thing to do? If not, what would you recommend?
Sounds like you diagnosed the problem correctly. IMAP4Server needs to handle Deferreds here and doesn't currently.
Awesome, that's what I've been trying to do for the past couple of days. Definitely learning a lot of new things :)
Perhaps you should file a ticket for this? (Searching for one first, of course, to see if it already exists).