diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-09-04 12:45:44 -0400 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-09-12 13:00:28 -0400 |
commit | d8ac9c0dd1bf8f9b4945dde20c02bb85966483be (patch) | |
tree | f1f4eede1133a152516d90bf0bbaf7e653eb8108 | |
parent | ca4bf8a3d0cbc58e241bab32cf5303cb5b3a3a80 (diff) | |
download | evolution-data-server-d8ac9c0dd1bf8f9b4945dde20c02bb85966483be.tar.gz |
CamelIMAPXFolder: Finish camel_imapx_folder_list_mailbox().
Implement the part where we actually issue the LIST command.
-rw-r--r-- | 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 23b8286b2..10b6537e9 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); |