imap: Tidied up the APPEND and final APPEND response functions

Removed unnecessary state changes on failure and setting of result codes
on success.