Implement ImapFolderAgent.

As promised in #309, here's ImapFolderAgent.
While this is working for me well so far, I'll add more specs later.