From 5a0b85e58639f5a9b9e2a1aa6b1882da6b2e6648 Mon Sep 17 00:00:00 2001
From: Michael James Gratton <mike@vee.net>
Date: Tue, 4 Oct 2016 00:06:54 +1100
Subject: [PATCH] Fix compilation with valac git master.

---
 src/engine/imap-db/imap-db-folder.vala                   | 16 ++++++++--------
 src/engine/imap-engine/imap-engine-generic-account.vala  |  4 ++--
 src/engine/imap-engine/imap-engine-minimal-folder.vala   |  5 +++--
 .../imap-engine/replay-ops/imap-engine-mark-email.vala   |  8 ++++----
 src/engine/imap/response/imap-fetch-data-decoder.vala    |  2 +-
 5 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/engine/imap-db/imap-db-folder.vala b/src/engine/imap-db/imap-db-folder.vala
index 81e963a..b3e02e8 100644
--- a/src/engine/imap-db/imap-db-folder.vala
+++ b/src/engine/imap-db/imap-db-folder.vala
@@ -870,10 +870,10 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
         if (unread_status.size > 0)
             unread_updated(unread_status);
     }
-    
-    public async Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags>? get_email_flags_async(
-        Gee.Collection<ImapDB.EmailIdentifier> ids, Cancellable? cancellable) throws Error {
-        Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags>? map = null;
+
+    internal async Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags>? get_email_flags_async(
+        Gee.Collection<EmailIdentifier> ids, Cancellable? cancellable) throws Error {
+        Gee.Map<EmailIdentifier, Geary.EmailFlags>? map = null;
         yield db.exec_transaction_async(Db.TransactionType.RO, (cx, cancellable) => {
             map = do_get_email_flags(cx, ids, cancellable);
             
@@ -1085,11 +1085,11 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
         if (ids.size == 0)
             return null;
         
-        Gee.HashMap<Geary.EmailIdentifier, Geary.Email.Field> map = new Gee.HashMap<
-            Geary.EmailIdentifier, Geary.Email.Field>();
+        Gee.HashMap<ImapDB.EmailIdentifier,Geary.Email.Field> map = new Gee.HashMap<
+            ImapDB.EmailIdentifier,Geary.Email.Field>();
         
         // Break up the work
-        Gee.List<ImapDB.EmailIdentifier> list = new Gee.ArrayList<Geary.EmailIdentifier>();
+        Gee.List<ImapDB.EmailIdentifier> list = new Gee.ArrayList<ImapDB.EmailIdentifier>();
         Gee.Iterator<ImapDB.EmailIdentifier> iter = ids.iterator();
         while (iter.next()) {
             list.add(iter.get());
@@ -1576,7 +1576,7 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
         Db.Statement fetch_stmt = cx.prepare("SELECT flags FROM MessageTable WHERE id=?");
         
         Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags> map = new Gee.HashMap<
-            Geary.EmailIdentifier, Geary.EmailFlags>();
+            ImapDB.EmailIdentifier, Geary.EmailFlags>();
         // TODO: Unroll this loop
         foreach (LocationIdentifier location in locs) {
             fetch_stmt.reset(Db.ResetScope.CLEAR_BINDINGS);
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala b/src/engine/imap-engine/imap-engine-generic-account.vala
index 16e04da..afcd9f0 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -807,7 +807,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
         
         // If path in local but not remote (and isn't local-only, i.e. the Outbox), need to remove it
         Gee.ArrayList<Geary.Folder> to_remove
-            = Geary.traverse<Gee.Map.Entry<FolderPath, Imap.Folder>>(existing_folders)
+            = Geary.traverse<Gee.Map.Entry<FolderPath,Geary.Folder>>(existing_folders)
             .filter(e => !remote_folders.has_key(e.key) && !local_only.has_key(e.key))
             .map<Geary.Folder>(e => (Geary.Folder) e.value)
             .to_array_list();
@@ -834,7 +834,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
                 debug("Unable to fetch local folder after cloning: %s", convert_err.message);
             }
         }
-        Gee.Collection<MinimalFolder> engine_added = new Gee.ArrayList<Geary.Folder>();
+        Gee.Collection<MinimalFolder> engine_added = new Gee.ArrayList<MinimalFolder>();
         engine_added.add_all(build_folders(folders_to_build));
         
         Gee.ArrayList<Geary.Folder> engine_removed = new Gee.ArrayList<Geary.Folder>();
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 09486f4..c1a8d99 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -1412,8 +1412,9 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
         Geary.EmailFlags? flags_to_add, Geary.EmailFlags? flags_to_remove,
         Cancellable? cancellable = null) throws Error {
         check_open("mark_email_async");
-        
-        MarkEmail mark = new MarkEmail(this, to_mark, flags_to_add, flags_to_remove, cancellable);
+        check_ids("mark_email_async", to_mark);
+
+        MarkEmail mark = new MarkEmail(this, (Gee.List<ImapDB.EmailIdentifier>) to_mark, flags_to_add, flags_to_remove, cancellable);
         replay_queue.schedule(mark);
         
         yield mark.wait_for_ready_async(cancellable);
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-mark-email.vala b/src/engine/imap-engine/replay-ops/imap-engine-mark-email.vala
index 21968c8..4f326d2 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-mark-email.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-mark-email.vala
@@ -6,13 +6,13 @@
 
 private class Geary.ImapEngine.MarkEmail : Geary.ImapEngine.SendReplayOperation {
     private MinimalFolder engine;
-    private Gee.List<Geary.EmailIdentifier> to_mark = new Gee.ArrayList<Geary.EmailIdentifier>();
+    private Gee.List<ImapDB.EmailIdentifier> to_mark = new Gee.ArrayList<ImapDB.EmailIdentifier>();
     private Geary.EmailFlags? flags_to_add;
     private Geary.EmailFlags? flags_to_remove;
     private Gee.Map<ImapDB.EmailIdentifier, Geary.EmailFlags>? original_flags = null;
     private Cancellable? cancellable;
     
-    public MarkEmail(MinimalFolder engine, Gee.List<Geary.EmailIdentifier> to_mark, 
+    public MarkEmail(MinimalFolder engine, Gee.List<ImapDB.EmailIdentifier> to_mark, 
         Geary.EmailFlags? flags_to_add, Geary.EmailFlags? flags_to_remove, 
         Cancellable? cancellable = null) {
         base("MarkEmail", OnError.RETRY);
@@ -28,7 +28,7 @@ private class Geary.ImapEngine.MarkEmail : Geary.ImapEngine.SendReplayOperation
     public override void notify_remote_removed_ids(Gee.Collection<ImapDB.EmailIdentifier> ids) {
         // don't bother updating on server or backing out locally
         if (original_flags != null)
-            Collection.map_unset_all_keys<ImapDB.EmailIdentifier, Geary.EmailFlags>(original_flags, ids);
+            Collection.map_unset_all_keys<EmailIdentifier, Geary.EmailFlags>(original_flags, ids);
     }
     
     public override void get_ids_to_be_remote_removed(Gee.Collection<ImapDB.EmailIdentifier> ids) {
@@ -50,7 +50,7 @@ private class Geary.ImapEngine.MarkEmail : Geary.ImapEngine.SendReplayOperation
             cancellable);
         
         // Notify using flags from DB.
-        Gee.Map<Geary.EmailIdentifier, Geary.EmailFlags>? map = yield engine.local_folder.get_email_flags_async(
+        Gee.Map<EmailIdentifier, Geary.EmailFlags>? map = yield engine.local_folder.get_email_flags_async(
             original_flags.keys, cancellable);
         if (map != null && map.size > 0)
             engine.replay_notify_email_flags_changed(map);
diff --git a/src/engine/imap/response/imap-fetch-data-decoder.vala b/src/engine/imap/response/imap-fetch-data-decoder.vala
index ed94ed3..5464111 100644
--- a/src/engine/imap/response/imap-fetch-data-decoder.vala
+++ b/src/engine/imap/response/imap-fetch-data-decoder.vala
@@ -95,7 +95,7 @@ public class Geary.Imap.MessageFlagsDecoder : Geary.Imap.FetchDataDecoder {
     }
     
     protected override MessageData decode_list(ListParameter listp) throws ImapError {
-        Gee.List<Flag> flags = new Gee.ArrayList<Flag>();
+        Gee.List<MessageFlag> flags = new Gee.ArrayList<MessageFlag>();
         for (int ctr = 0; ctr < listp.size; ctr++)
             flags.add(new MessageFlag(listp.get_as_string(ctr).ascii));
         
