IMAP: implement a special case for syncing an empty mailbox

"serpentine" on IRC reported a problem with QRESYNC (and correctly maintained
state):

 QRESYNC: UIDVALIDITY 1309542826 UIDNEXT 252 EXISTS 0 HIGHESTMODSEQ 10
 UIDMAP: empty

 15:42:55.295 >>> y4 SELECT Queue (QRESYNC (1309542826 10))␍␊
 15:42:55.563 <<< * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)␍␊
 15:42:55.563 <<< * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.␍␊
 15:42:55.563 <<< * 0 EXISTS␍␊
 15:42:55.563 <<< * 0 RECENT␍␊
 15:42:55.563 <<< * OK [UIDVALIDITY 1309542826] UIDs valid␍␊
 15:42:55.563 <<< * OK [UIDNEXT 256] Predicted next UID␍␊
 15:42:55.563 <<< * OK [HIGHESTMODSEQ 22] Highest␍␊
 15:42:55.563 <<< * VANISHED (EARLIER) 252:255␍␊
 15:42:55.563 <<< y4 OK [READ-WRITE] Select completed.␍␊
 15:42:55.563 TreeItemMailbox::handleVanished VANISHED attempted to remove too many messages
 15:42:55.563 conn Synchronizing mailbox...
 15:42:55.563 Imap::Mailbox::ObtainSynchronizedMailboxTask STATE_SELECTING Queue generic synchronization from previous state
 15:42:55.563 Imap::Mailbox::ObtainSynchronizedMailboxTask STATE_SYNCING_UIDS Queue Syncing UIDs
 15:42:55.563 >>> y5 UID SEARCH RETURN () ALL␍␊
 15:42:55.802 <<< * ESEARCH (TAG "y5") UID␍␊
 15:42:55.802 <<< y5 OK Search completed (0.000 secs).␍␊
 15:42:55.802 conn Mailbox opened.
 15:42:55.802 Imap::Mailbox::ObtainSynchronizedMailboxTask STATE_SYNCING_FLAGS Queue UIDs synchronized
 15:42:55.802 Imap::Mailbox::ObtainSynchronizedMailboxTask STATE_SYNCING_FLAGS Queue Syncing flags
 15:42:55.802 >>> y6 FETCH 1:0 (FLAGS) (CHANGEDSINCE 10)␍␊
 15:42:56.045 <<< y6 BAD Error in IMAP command FETCH: Invalid messageset␍␊
 15:42:56.045 Model BAD response: y6 BAD Error in IMAP command FETCH: Invalid messageset

This change adds an explicit shortcut for an empty mailbox. An older bug is fixed as a nice bonus :).

fixes #537