lib: Rework interface for maildir_flags synchronization