[geary/wip/uidplus-drafts-726665: 1/3] Add folder property to signify no UIDPLUS



commit a69e26819d3e59489ae1f89a6962ab0698e46e43
Author: Charles Lindsay <chaz yorba org>
Date:   Wed Mar 19 14:45:58 2014 -0700

    Add folder property to signify no UIDPLUS

 .../api/geary-aggregated-folder-properties.vala    |    2 +-
 src/engine/api/geary-folder-properties.vala        |   11 ++++++++++-
 src/engine/api/geary-search-folder.vala            |    2 +-
 .../outbox/smtp-outbox-folder-properties.vala      |    2 +-
 src/engine/imap/api/imap-folder-properties.vala    |    8 ++++++--
 src/engine/imap/api/imap-folder.vala               |    2 ++
 6 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/engine/api/geary-aggregated-folder-properties.vala 
b/src/engine/api/geary-aggregated-folder-properties.vala
index ea165e2..986b9e6 100644
--- a/src/engine/api/geary-aggregated-folder-properties.vala
+++ b/src/engine/api/geary-aggregated-folder-properties.vala
@@ -23,7 +23,7 @@ private class Geary.AggregatedFolderProperties : Geary.FolderProperties {
      */
     public AggregatedFolderProperties(bool is_local_only, bool is_virtual) {
         // Set defaults.
-        base(0, 0, Trillian.UNKNOWN, Trillian.UNKNOWN, Trillian.UNKNOWN, is_local_only, is_virtual);
+        base(0, 0, Trillian.UNKNOWN, Trillian.UNKNOWN, Trillian.UNKNOWN, is_local_only, is_virtual, false);
     }
     
     /**
diff --git a/src/engine/api/geary-folder-properties.vala b/src/engine/api/geary-folder-properties.vala
index f40cf7c..2f571da 100644
--- a/src/engine/api/geary-folder-properties.vala
+++ b/src/engine/api/geary-folder-properties.vala
@@ -59,8 +59,16 @@ public abstract class Geary.FolderProperties : BaseObject {
      */
     public bool is_virtual { get; private set; }
     
+    /**
+     * True if APPEND on the folder will never return the created UID.  This is
+     * for servers that don't support UIDPLUS.  Most servers support UIDPLUS,
+     * so this will usually be false.
+     */
+    public bool create_never_returns_id { get; protected set; }
+    
     protected FolderProperties(int email_total, int email_unread, Trillian has_children,
-        Trillian supports_children, Trillian is_openable, bool is_local_only, bool is_virtual) {
+        Trillian supports_children, Trillian is_openable, bool is_local_only, bool is_virtual,
+        bool create_never_returns_id) {
         this.email_total = email_total;
         this.email_unread = email_unread;
         this.has_children = has_children;
@@ -68,6 +76,7 @@ public abstract class Geary.FolderProperties : BaseObject {
         this.is_openable = is_openable;
         this.is_local_only = is_local_only;
         this.is_virtual = is_virtual;
+        this.create_never_returns_id = create_never_returns_id;
     }
 }
 
diff --git a/src/engine/api/geary-search-folder.vala b/src/engine/api/geary-search-folder.vala
index 518b409..672853f 100644
--- a/src/engine/api/geary-search-folder.vala
+++ b/src/engine/api/geary-search-folder.vala
@@ -14,7 +14,7 @@ public class Geary.SearchFolderRoot : Geary.FolderRoot {
 
 public class Geary.SearchFolderProperties : Geary.FolderProperties {
     public SearchFolderProperties(int total, int unread) {
-        base(total, unread, Trillian.FALSE, Trillian.FALSE, Trillian.TRUE, true, true);
+        base(total, unread, Trillian.FALSE, Trillian.FALSE, Trillian.TRUE, true, true, false);
     }
     
     public void set_total(int total) {
diff --git a/src/engine/imap-db/outbox/smtp-outbox-folder-properties.vala 
b/src/engine/imap-db/outbox/smtp-outbox-folder-properties.vala
index 1873439..535e3ef 100644
--- a/src/engine/imap-db/outbox/smtp-outbox-folder-properties.vala
+++ b/src/engine/imap-db/outbox/smtp-outbox-folder-properties.vala
@@ -6,7 +6,7 @@
 
 private class Geary.SmtpOutboxFolderProperties : Geary.FolderProperties {
     public SmtpOutboxFolderProperties(int total, int unread) {
-        base (total, unread, Trillian.FALSE, Trillian.FALSE, Trillian.TRUE, true, false);
+        base (total, unread, Trillian.FALSE, Trillian.FALSE, Trillian.TRUE, true, false, false);
     }
     
     public void set_total(int total) {
diff --git a/src/engine/imap/api/imap-folder-properties.vala b/src/engine/imap/api/imap-folder-properties.vala
index 4b7b4b3..c062186 100644
--- a/src/engine/imap/api/imap-folder-properties.vala
+++ b/src/engine/imap/api/imap-folder-properties.vala
@@ -67,7 +67,7 @@ public class Geary.Imap.FolderProperties : Geary.FolderProperties {
         // give the base class a zero email_unread, as the notion of "unknown" doesn't exist in
         // its contract
         base (messages, email_unread, Trillian.UNKNOWN, Trillian.UNKNOWN, Trillian.UNKNOWN, false,
-            false);
+            false, false);
         
         select_examine_messages = messages;
         status_messages = -1;
@@ -82,7 +82,7 @@ public class Geary.Imap.FolderProperties : Geary.FolderProperties {
     
     public FolderProperties.status(StatusData status, MailboxAttributes attrs) {
         base (status.messages, status.unseen, Trillian.UNKNOWN, Trillian.UNKNOWN, Trillian.UNKNOWN,
-            false, false);
+            false, false, false);
         
         select_examine_messages = -1;
         status_messages = status.messages;
@@ -213,5 +213,9 @@ public class Geary.Imap.FolderProperties : Geary.FolderProperties {
         // update base class value (which clients see)
         email_unread = count;
     }
+    
+    public void set_from_session_capabilities(Capabilities capabilities) {
+        create_never_returns_id = !capabilities.supports_uidplus();
+    }
 }
 
diff --git a/src/engine/imap/api/imap-folder.vala b/src/engine/imap/api/imap-folder.vala
index 71741ad..72c2c23 100644
--- a/src/engine/imap/api/imap-folder.vala
+++ b/src/engine/imap/api/imap-folder.vala
@@ -95,6 +95,8 @@ private class Geary.Imap.Folder : BaseObject {
         session.status_response_received.connect(on_status_response);
         session.disconnected.connect(on_disconnected);
         
+        properties.set_from_session_capabilities(session.capabilities);
+        
         StatusResponse response = yield session.select_async(
             new MailboxSpecifier.from_folder_path(path, info.delim), cancellable);
         if (response.status != Status.OK) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]