'Syncs messages in this folder to the destination dstfolder.
This is the high level entry for syncing messages in one direction.
Syncsteps are:
Pass1: Copy locally existing messages
Copy messages in self, but not statusfolder to dstfolder if not
already in dstfolder. dstfolder might assign a new UID (e.g. if
uploading to IMAP). Update statusfolder.
Pass2: Remove locally deleted messages
Get all UIDS in statusfolder but not self. These are messages
that were deleted in \'self\'. Delete those from dstfolder and
statusfolder.
After this pass, the message lists should be identical wrt the
uids present (except for potential negative uids that couldn\'t
be placed anywhere).
Pass3: Synchronize flag changes
Compare flag mismatches in self with those in statusfolder. If
msg has a valid UID and exists on dstfolder (has not e.g. been
deleted there), sync the flag change to both dstfolder and
statusfolder.
Pass4: Synchronize label changes (Gmail only)
Compares label mismatches in self with those in statusfolder.
If msg has a valid UID and exists on dstfolder, syncs the labels
to both dstfolder and statusfolder.
:param dstfolder: Folderinstance to sync the msgs to.
:param statusfolder: LocalStatus instance to sync against.'

def syncmessagesto(self, dstfolder, statusfolder):

    for action in self.syncmessagesto_passes:
        if offlineimap.accounts.Account.abort_NOW_signal.is_set():
            break
        try:
            action(dstfolder, statusfolder)
        except KeyboardInterrupt:
            raise
        except OfflineImapError as e:
            if (e.severity > OfflineImapError.ERROR.FOLDER):
                raise
            self.ui.error(e, exc_info()[2], ('while    syncing    %s    [account    %s]' % (self, self.accountname)))
        except Exception as e:
            self.ui.error(e, exc_info()[2], ('while    syncing    %s    [account    %s]' % (self, self.accountname)))
            raise
