[evolution-data-server/imap-notify: 18/40] CamelIMAPXServer: LIST a mailbox after creating it.



commit 909f3ae6e2af8f749562ca15c5dc25938793ae46
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Sep 11 13:04:31 2013 -0400

    CamelIMAPXServer: LIST a mailbox after creating it.
    
    Listing the mailbox will trigger our untagged LIST handler.  This
    simulates being notified of a newly-created mailbox, so we can just
    let the callback functions handle the bookkeeping.

 camel/camel-imapx-server.c |   15 +++++++++++++++
 camel/camel-imapx-store.c  |   17 ++++-------------
 2 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index b6f9b62..21073ec 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -8892,6 +8892,21 @@ camel_imapx_server_create_mailbox (CamelIMAPXServer *is,
 
        success = imapx_submit_job (is, job, error);
 
+       if (success) {
+               gchar *utf7_pattern;
+
+               utf7_pattern = camel_utf8_utf7 (mailbox_name);
+
+               /* List the new mailbox so we trigger our untagged
+                * LIST handler.  This simulates being notified of
+                * a newly-created mailbox, so we can just let the
+                * callback functions handle the bookkeeping. */
+               success = camel_imapx_server_list (
+                       is, utf7_pattern, 0, cancellable, error);
+
+               g_free (utf7_pattern);
+       }
+
        camel_imapx_job_unref (job);
 
        return success;
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index ee6d9db..bce91a8 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -2002,25 +2002,16 @@ check_separator:
                goto exit;
        }
 
+       /* This also LISTs the mailbox after creating it, which
+        * triggers the CamelIMAPXServer::mailbox-created signal
+        * and all the local processing that goes along with it. */
        success = camel_imapx_server_create_mailbox (
                imapx_server, mailbox_name, cancellable, error);
 
        if (success) {
-               CamelStoreSummary *summary;
-               CamelIMAPXStoreInfo *si;
-               const gchar *folder_path;
-
-               summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
-
-               si = camel_imapx_store_summary_add_from_mailbox (
-                       imapx_store->summary, mailbox_name, separator);
-               camel_store_summary_save (summary);
-               folder_path = camel_store_info_path (
-                       summary, (CamelStoreInfo *) si);
                fi = imapx_store_build_folder_info (
-                       imapx_store, folder_path,
+                       imapx_store, folder_name,
                        CAMEL_FOLDER_NOCHILDREN);
-               camel_store_folder_created (store, fi);
        }
 
 exit:


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