imap: Added stricter parsing of continuation responses

Enhanced the parsing to only allow continuation responses in some
states.