[WIP] Detect flag changes during initial sync.

In this chapter of the IMAP sync saga, we restructure the Gmail and condstore
sync engines to allow us to detect flag changes during initial sync.

For Gmail, we'd previously run __check_new_g_thrids() in a separate greenlet
during initial sync. However, this wouldn't detect flag changes (marking a
thread as read, etc.).

The key observation is that during initial sync, we should really be doing the
same highestmodseq-updating that we do when polling, in order to fully detect
changes.

Smaller associated changes:
 * Define classes UIDStack and GMessageStack that wrap gevent.LifoQueue, to
   allow for more concise manipulations of the download stacks.
 * Don't track `update_uid_count` or `delete_uid_count` when calling
   update_uid_counts() -- we don't actually use those numbers for anything.