[evolution-data-server/gnome-2-30] Handle [CLOSED] status (RFC5162).
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-30] Handle [CLOSED] status (RFC5162).
- Date: Mon, 28 Jun 2010 19:35:12 +0000 (UTC)
commit 93b397e5c397d9c8df9ab308a2e23980d1165d80
Author: David Woodhouse <David Woodhouse intel com>
Date: Sun Jun 20 23:36:28 2010 +0100
Handle [CLOSED] status (RFC5162).
This indicates precisely when the selected mailbox changes to the new
mailbox during the SELECT command, before its tagged completion.
This allows us to assign unsolicited FETCH responses to the correct
mailbox; with QRESYNC those will arrive before the SELECT completion.
It also theoretically allows us to pipeline SELECT requests, although
there's not a huge amount of point in that and we'll have other issues
with our implementation if we do that.
(cherry picked from commit 1c3a459945ebfac7a745087c68eb94a21ff86d27)
camel/providers/imapx/camel-imapx-server.c | 31 +++++++++++++++++++++++--
camel/providers/imapx/camel-imapx-tokens.txt | 1 +
camel/providers/imapx/camel-imapx-utils.c | 1 +
camel/providers/imapx/camel-imapx-utils.h | 1 +
4 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 377f022..e656985 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1463,6 +1463,16 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
return -1;
camel_object_trigger_event(imap, "status", sinfo);
switch (sinfo->condition) {
+ case IMAPX_CLOSED:
+ c(printf("previously selected folder is now closed\n"));
+ if (imap->select_pending && !imap->select_folder) {
+ const gchar *full_name;
+ imap->select_folder = imap->select_pending;
+ full_name = camel_folder_get_full_name (imap->select_folder);
+
+ imap->select = g_strdup(full_name);
+ }
+ break;
case IMAPX_READ_WRITE:
imap->mode = IMAPX_MODE_READ|IMAPX_MODE_WRITE;
c(printf("folder is read-write\n"));
@@ -2104,15 +2114,25 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
cn = cn->next;
}
}
-
if (is->select_pending)
camel_object_unref(is->select_pending);
+
+ /* A [CLOSED] status may have caused us to assume that it had happened */
+ if (is->select) {
+ g_free(is->select);
+ is->select = NULL;
+ is->select_folder = NULL;
+ }
+ is->state = IMAPX_INITIALISED;
} else {
CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) is->select_pending;
c(printf("Select ok!\n"));
- is->select_folder = is->select_pending;
- is->select = g_strdup(is->select_folder->full_name);
+ if (!is->select_folder) {
+ /* This could have been done earlier by a [CLOSED] status */
+ is->select_folder = is->select_pending;
+ is->select = g_strdup(is->select_folder->full_name);
+ }
is->state = IMAPX_SELECTED;
ifolder->exists_on_server = is->exists;
#if 0
@@ -2166,6 +2186,11 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, CamelE
camel_object_unref(is->select_folder);
is->select = NULL;
is->select_folder = NULL;
+ } else {
+ /* If no folder was selected, we won't get a [CLOSED] status
+ so just point select_folder at the new folder immediately */
+ is->select_folder = is->select_pending;
+ is->select = g_strdup(is->select_folder->full_name);
}
is->uidvalidity = 0;
diff --git a/camel/providers/imapx/camel-imapx-tokens.txt b/camel/providers/imapx/camel-imapx-tokens.txt
index d1d3638..6a9abbd 100644
--- a/camel/providers/imapx/camel-imapx-tokens.txt
+++ b/camel/providers/imapx/camel-imapx-tokens.txt
@@ -11,6 +11,7 @@ BODYSTRUCTURE, IMAPX_BODYSTRUCTURE
BYE, IMAPX_BYE
CAPABILITY, IMAPX_CAPABILITY
COPYUID, IMAPX_COPYUID
+CLOSED, IMAPX_CLOSED
ENVELOPE, IMAPX_ENVELOPE
EXISTS, IMAPX_EXISTS
EXPUNGE, IMAPX_EXPUNGE
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index f5237df..e67cd4a 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -1610,6 +1610,7 @@ imapx_parse_status(CamelIMAPXStream *is, CamelException *ex)
case IMAPX_ALERT:
case IMAPX_PARSE:
case IMAPX_TRYCREATE:
+ case IMAPX_CLOSED:
break;
case IMAPX_APPENDUID:
sinfo->u.appenduid.uidvalidity = camel_imapx_stream_number(is, ex);
diff --git a/camel/providers/imapx/camel-imapx-utils.h b/camel/providers/imapx/camel-imapx-utils.h
index a652553..e05f23e 100644
--- a/camel/providers/imapx/camel-imapx-utils.h
+++ b/camel/providers/imapx/camel-imapx-utils.h
@@ -20,6 +20,7 @@ typedef enum _camel_imapx_id_t {
IMAPX_BODYSTRUCTURE,
IMAPX_BYE,
IMAPX_CAPABILITY,
+ IMAPX_CLOSED,
IMAPX_COPYUID,
IMAPX_ENVELOPE,
IMAPX_EXISTS,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]