[evolution-data-server] CamelIMAPXServer: Fix handling of LSUB responses.



commit 716b25061ff222910135fe7c6c85df16f9214f83
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Dec 10 16:00:13 2013 -0500

    CamelIMAPXServer: Fix handling of LSUB responses.
    
    If we receive an LSUB response on a mailbox name but no corresponding
    LIST response, ignore it.  IMAP allows subscriptions to mailbox names
    regardless of whether the mailbox actually exists.  Not useful to us.

 camel/providers/imapx/camel-imapx-server.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 0b4159a..21fdc1d 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2296,7 +2296,6 @@ imapx_untagged_lsub (CamelIMAPXServer *is,
        CamelIMAPXListResponse *response;
        CamelIMAPXMailbox *mailbox;
        const gchar *mailbox_name;
-       gboolean emit_mailbox_created = FALSE;
        gboolean emit_mailbox_updated = FALSE;
        gchar separator;
 
@@ -2329,21 +2328,20 @@ imapx_untagged_lsub (CamelIMAPXServer *is,
                g_mutex_unlock (&is->priv->namespaces_lock);
        }
 
-       /* Create or update a corresponding CamelIMAPXMailbox. */
+       /* Update a corresponding CamelIMAPXMailbox.
+        *
+        * Note, don't create the CamelIMAPXMailbox like we do for a LIST
+        * response.  We always issue LIST before LSUB on a mailbox name,
+        * so if we don't already have a CamelIMAPXMailbox instance then
+        * this is a subscription on a non-existent mailbox.  Skip it. */
        g_mutex_lock (&is->priv->mailboxes_lock);
        mailbox = imapx_server_ref_mailbox_unlocked (is, mailbox_name);
        if (mailbox != NULL) {
                camel_imapx_mailbox_handle_lsub_response (mailbox, response);
                emit_mailbox_updated = TRUE;
-       } else {
-               mailbox = imapx_server_create_mailbox_unlocked (is, response);
-               emit_mailbox_created = (mailbox != NULL);
        }
        g_mutex_unlock (&is->priv->mailboxes_lock);
 
-       if (emit_mailbox_created)
-               g_signal_emit (is, signals[MAILBOX_CREATED], 0, mailbox);
-
        if (emit_mailbox_updated)
                g_signal_emit (is, signals[MAILBOX_UPDATED], 0, mailbox);
 


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