diff options
author | Milan Crha <mcrha@redhat.com> | 2015-07-03 12:55:10 +0200 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2015-07-03 12:55:10 +0200 |
commit | a5459e43e427775eb0cc644415e6d1cc07a1328a (patch) | |
tree | b5b3b8592c78b358d2eb2c2c42923a86b0a5ccdc /camel | |
parent | 465b310c9e9bcb14e65b03ed89263d31deecc909 (diff) | |
download | evolution-data-server-a5459e43e427775eb0cc644415e6d1cc07a1328a.tar.gz |
Bug 685035 - [IMAPx] Nonsensical progress report on folder update
Diffstat (limited to 'camel')
-rw-r--r-- | camel/providers/imapx/camel-imapx-server.c | 36 | ||||
-rw-r--r-- | camel/providers/imapx/camel-imapx-server.h | 3 |
2 files changed, 28 insertions, 11 deletions
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c index b14c1d59c..12c977c92 100644 --- a/camel/providers/imapx/camel-imapx-server.c +++ b/camel/providers/imapx/camel-imapx-server.c @@ -2150,7 +2150,7 @@ imapx_untagged_exists (CamelIMAPXServer *is, g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE); - mailbox = camel_imapx_server_ref_selected (is); + mailbox = camel_imapx_server_ref_pending_or_selected (is); if (mailbox == NULL) { g_warning ("%s: No mailbox available", G_STRFUNC); @@ -2708,7 +2708,7 @@ imapx_untagged_recent (CamelIMAPXServer *is, g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE); - mailbox = camel_imapx_server_ref_selected (is); + mailbox = camel_imapx_server_ref_pending_or_selected (is); if (mailbox == NULL) { g_warning ("%s: No mailbox available", G_STRFUNC); @@ -2889,15 +2889,7 @@ imapx_untagged_ok_no_bad (CamelIMAPXServer *is, overwritten with a value from a different mailbox, thus the offline cache will persist, instead of being vanished. */ - g_mutex_lock (&is->priv->select_lock); - - mailbox = g_weak_ref_get (&is->priv->select_pending); - if (!mailbox) - mailbox = g_weak_ref_get (&is->priv->select_mailbox); - if (!mailbox) - mailbox = g_weak_ref_get (&is->priv->select_closing); - - g_mutex_unlock (&is->priv->select_lock); + mailbox = camel_imapx_server_ref_pending_or_selected (is); is->priv->context->sinfo = imapx_parse_status ( CAMEL_IMAPX_INPUT_STREAM (input_stream), @@ -8395,6 +8387,28 @@ camel_imapx_server_ref_selected (CamelIMAPXServer *is) return mailbox; } +/* Some untagged responses updated pending SELECT mailbox, not the currently + selected or closing one, thus use this function instead. */ +CamelIMAPXMailbox * +camel_imapx_server_ref_pending_or_selected (CamelIMAPXServer *is) +{ + CamelIMAPXMailbox *mailbox; + + g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), NULL); + + g_mutex_lock (&is->priv->select_lock); + + mailbox = g_weak_ref_get (&is->priv->select_pending); + if (mailbox == NULL) + mailbox = g_weak_ref_get (&is->priv->select_mailbox); + if (mailbox == NULL) + mailbox = g_weak_ref_get (&is->priv->select_closing); + + g_mutex_unlock (&is->priv->select_lock); + + return mailbox; +} + static void imapx_disconnect (CamelIMAPXServer *is) { diff --git a/camel/providers/imapx/camel-imapx-server.h b/camel/providers/imapx/camel-imapx-server.h index bf34d4c60..78289c76b 100644 --- a/camel/providers/imapx/camel-imapx-server.h +++ b/camel/providers/imapx/camel-imapx-server.h @@ -152,6 +152,9 @@ GOutputStream * camel_imapx_server_ref_output_stream (CamelIMAPXServer *is); CamelIMAPXMailbox * camel_imapx_server_ref_selected (CamelIMAPXServer *is); +CamelIMAPXMailbox * + camel_imapx_server_ref_pending_or_selected + (CamelIMAPXServer *is); gboolean camel_imapx_server_connect (CamelIMAPXServer *is, GCancellable *cancellable, GError **error); |