[evolution-data-server] Bug 740627 - [IMAPx] Cannot append to a write-only folder
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 740627 - [IMAPx] Cannot append to a write-only folder
- Date: Tue, 25 Nov 2014 16:36:41 +0000 (UTC)
commit ab8756de433f5292e9396da35324b48283088af3
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 25 17:35:35 2014 +0100
Bug 740627 - [IMAPx] Cannot append to a write-only folder
camel/providers/imapx/camel-imapx-server.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 9cd534a..0b4eeb6 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3996,6 +3996,7 @@ imapx_command_select_done (CamelIMAPXServer *is,
CamelIMAPXCommandQueue *failed;
GQueue trash = G_QUEUE_INIT;
GList *list, *link;
+ gboolean noperm_error;
c (is->tagprefix, "Select failed: %s\n", local_error ? local_error->message : "Unknown
error");
@@ -4012,6 +4013,9 @@ imapx_command_select_done (CamelIMAPXServer *is,
QUEUE_LOCK (is);
+ noperm_error = select_pending != NULL && ic->status && ic->status->result == IMAPX_NO &&
+ (ic->status->condition == IMAPX_NOPERM || ic->status->condition == IMAPX_UNKNOWN);
+
if (select_pending != NULL) {
GList *head = camel_imapx_command_queue_peek_head_link (is->queue);
@@ -4035,6 +4039,13 @@ imapx_command_select_done (CamelIMAPXServer *is,
}
}
+ if (noperm_error) {
+ /* This avoids another SELECT try on this mailbox;
+ the mailbox can be write-only in this case. */
+ if (camel_imapx_mailbox_get_permanentflags (select_pending) == ~0)
+ camel_imapx_mailbox_set_permanentflags (select_pending, 0);
+ }
+
while ((link = g_queue_pop_head (&trash)) != NULL) {
CamelIMAPXCommand *cw = link->data;
camel_imapx_command_ref (cw);
@@ -4059,7 +4070,8 @@ imapx_command_select_done (CamelIMAPXServer *is,
continue;
}
- camel_imapx_job_cancel (failed_job);
+ if (!noperm_error)
+ camel_imapx_job_cancel (failed_job);
if (ic->status)
cw->status = imapx_copy_status (ic->status);
@@ -8438,7 +8450,11 @@ camel_imapx_server_copy_message (CamelIMAPXServer *is,
g_return_val_if_fail (CAMEL_IS_IMAPX_MAILBOX (destination), FALSE);
g_return_val_if_fail (uids != NULL, FALSE);
- if (!imapx_ensure_mailbox_permanentflags (is, destination, cancellable, error))
+ /* That's okay if the "SELECT" fails here, as it can be due to
+ the folder being write-only; just ignore the error and continue. */
+ imapx_ensure_mailbox_permanentflags (is, destination, cancellable, NULL);
+
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
data = g_slice_new0 (CopyMessagesData);
@@ -8504,7 +8520,11 @@ camel_imapx_server_append_message (CamelIMAPXServer *is,
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
/* CamelMessageInfo can be NULL. */
- if (!imapx_ensure_mailbox_permanentflags (is, mailbox, cancellable, error))
+ /* That's okay if the "SELECT" fails here, as it can be due to
+ the folder being write-only; just ignore the error and continue. */
+ imapx_ensure_mailbox_permanentflags (is, mailbox, cancellable, NULL);
+
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
/* Append just assumes we have no/a dodgy connection. We dump
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]