Fix a SEGV setting NULL folders IMAP UIDs

I was forwarding the IMAP UID setting of messages when I know it, but
forgetting to not do that when the message didn't exist (and was
therefor NULL).
Write the whole message, not just the body

This fails when passed a proper MIME message to insert into the
database: it only inserts the "body" part (which is the plain text
stuff in the middle), not the whole message.  The fix is to simply
insert the whole message, using the "root" part instead of the "body"
part.

I didn't notice this because before I was only inserting non-MIME
messages that I hand-wrote.
Obey mhimap-{fetch,sync,purge} differences

Before this these would all do exactly the same thing, now they do
slightly different things!