imap: Fleshed out command processing.

* Still doesn't do anything useful, though.