[geary/geary-0.8] Don't assert() if Imap.Folder created w/ mismatched name: Bug #739316



commit bc1e1731ef57f4ea9532c31d699314fb47832748
Author: Jim Nelson <jim yorba org>
Date:   Wed Nov 5 11:52:03 2014 -0800

    Don't assert() if Imap.Folder created w/ mismatched name: Bug #739316
    
    The assertion was a sanity check that's outlived its original purpose.
    When it triggers now, it means an internationalization/encoding issue,
    usually with non-Gmail servers that implement XLIST.  Rather than
    assert and make Geary unusuable for a subset of our non-English
    speaking users, log a message and continue.

 src/engine/imap/api/imap-folder.vala               |    9 ++++++++-
 .../imap/response/imap-mailbox-information.vala    |    6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/imap/api/imap-folder.vala b/src/engine/imap/api/imap-folder.vala
index 628f430..1bd9adf 100644
--- a/src/engine/imap/api/imap-folder.vala
+++ b/src/engine/imap/api/imap-folder.vala
@@ -72,7 +72,14 @@ private class Geary.Imap.Folder : BaseObject {
     public signal void disconnected(ClientSession.DisconnectReason reason);
     
     internal Folder(FolderPath path, ClientSessionManager session_mgr, StatusData status, MailboxInformation 
info) {
-        assert(status.mailbox.equal_to(info.mailbox));
+        // Used to assert() here, but that meant that any issue with internationalization/encoding
+        // made Geary unusable for a subset of servers accessed/configured in a non-English language...
+        // this is not the end of the world, but it does suggest an I18N issue, potentially with
+        // how XLIST returns folder names on different servers.
+        if (!status.mailbox.equal_to(info.mailbox)) {
+            message("%s: IMAP folder created with differing mailbox names (STATUS=%s LIST=%s)",
+                path.to_string(), status.to_string(), info.to_string());
+        }
         
         this.session_mgr = session_mgr;
         this.info = info;
diff --git a/src/engine/imap/response/imap-mailbox-information.vala 
b/src/engine/imap/response/imap-mailbox-information.vala
index 741a958..526096e 100644
--- a/src/engine/imap/response/imap-mailbox-information.vala
+++ b/src/engine/imap/response/imap-mailbox-information.vala
@@ -14,7 +14,7 @@
  * @see ListCommand
  */
 
-public class Geary.Imap.MailboxInformation : Object {
+public class Geary.Imap.MailboxInformation : BaseObject {
     /**
      * Name of the mailbox.
      */
@@ -94,5 +94,9 @@ public class Geary.Imap.MailboxInformation : Object {
     public Geary.FolderPath get_path(MailboxSpecifier? inbox_specifier) {
         return mailbox.to_folder_path(delim, inbox_specifier);
     }
+    
+    public string to_string() {
+        return "%s/%s".printf(mailbox.to_string(), attrs.to_string());
+    }
 }
 


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