Fix race condition in condstore IMAP sync.

We need to take both local_uids and stack_uids into account when figuring out
which uids are new in highestmodseq_update.

In order for this to work, also replace the GMessageStack and UIDStack
implementations with a single UIDStack, which maintains a stack of pairs (uid,
metadata), where the metadata field is optional. This is still a bit clunky,
but less so, and works across both Gmail and generic IMAP.