[evolution-data-server/imap-notify: 17/40] CamelIMAPXFolder: Finish camel_imapx_folder_list_mailbox().



commit d8ac9c0dd1bf8f9b4945dde20c02bb85966483be
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Sep 4 12:45:44 2013 -0400

    CamelIMAPXFolder: Finish camel_imapx_folder_list_mailbox().
    
    Implement the part where we actually issue the LIST command.

 camel/camel-imapx-folder.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-imapx-folder.c b/camel/camel-imapx-folder.c
index 23b8286..10b6537 100644
--- a/camel/camel-imapx-folder.c
+++ b/camel/camel-imapx-folder.c
@@ -1423,6 +1423,8 @@ camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
        CamelIMAPXStoreInfo *imapx_store_info;
        gchar *folder_path = NULL;
        gchar *mailbox_name = NULL;
+       gchar *pattern;
+       gboolean success;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_FOLDER (folder), FALSE);
 
@@ -1467,7 +1469,29 @@ camel_imapx_folder_list_mailbox (CamelIMAPXFolder *folder,
        /* Last resort is to issue a LIST command.  Maintainer should
         * monitor IMAP logs to make sure this is rarely if ever used. */
 
-       g_warn_if_reached ();  /* FIXME Implement this. */
+       pattern = camel_utf8_utf7 (mailbox_name);
+
+       /* This creates a mailbox instance from the LIST response. */
+       success = camel_imapx_server_list (
+               server, pattern, 0, cancellable, error);
+
+       g_free (pattern);
+
+       if (!success)
+               goto exit;
+
+       /* This might still return NULL if the mailbox has a
+        * /NonExistent attribute.  Otherwise this should work. */
+       mailbox = camel_imapx_server_ref_mailbox (server, mailbox_name);
+       if (mailbox != NULL) {
+               camel_imapx_folder_set_mailbox (folder, mailbox);
+       } else {
+               g_set_error (
+                       error, CAMEL_FOLDER_ERROR,
+                       CAMEL_FOLDER_ERROR_INVALID_STATE,
+                       _("No IMAP mailbox available for folder '%s'"),
+                       camel_folder_get_display_name (CAMEL_FOLDER (folder)));
+       }
 
 exit:
        g_clear_object (&server);


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