[evolution-data-server/imap-notify: 2/23] IMAPX: Support the NOTIFY extension.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/imap-notify: 2/23] IMAPX: Support the NOTIFY extension.
- Date: Tue, 10 Sep 2013 14:05:41 +0000 (UTC)
commit d4285e7648b789016485a15147a5e402bf67b9a7
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Jul 13 18:49:10 2013 -0400
IMAPX: Support the NOTIFY extension.
http://tools.ietf.org/html/rfc5465
NOTIFY replaces IDLE when available.
camel/camel-imapx-server.c | 29 +++++++++++++++++++++++++++++
camel/camel-imapx-utils.c | 3 ++-
camel/camel-imapx-utils.h | 3 ++-
3 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 07b00d5..208272c 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -3470,6 +3470,10 @@ imapx_use_idle (CamelIMAPXServer *is)
{
gboolean use_idle = FALSE;
+ /* No need for IDLE if the server supports NOTIFY. */
+ if (CAMEL_IMAPX_HAVE_CAPABILITY (is->cinfo, NOTIFY))
+ return FALSE;
+
if (CAMEL_IMAPX_HAVE_CAPABILITY (is->cinfo, IDLE)) {
CamelIMAPXSettings *settings;
@@ -4300,6 +4304,31 @@ preauthed:
is->use_qresync = FALSE;
}
+ /* Set NOTIFY options after enabling QRESYNC (if supported). */
+ if (CAMEL_IMAPX_HAVE_CAPABILITY (is->cinfo, NOTIFY)) {
+ GError *local_error = NULL;
+
+ /* XXX The list of FETCH attributes is negotiable. */
+ ic = camel_imapx_command_new (
+ is, "NOTIFY", NULL, "NOTIFY SET "
+ "(selected "
+ "(MessageNew (UID RFC822.SIZE RFC822.HEADER FLAGS)"
+ " MessageExpunge"
+ " FlagChange)) "
+ "(personal "
+ "(MessageNew"
+ " MessageExpunge"
+ " MailboxName"
+ " SubscriptionChange))");
+ imapx_command_run (is, ic, cancellable, &local_error);
+ camel_imapx_command_unref (ic);
+
+ if (local_error != NULL) {
+ g_propagate_error (error, local_error);
+ goto exception;
+ }
+ }
+
if (store->summary->namespaces == NULL) {
CamelIMAPXNamespaceList *nsl = NULL;
CamelIMAPXStoreNamespace *ns = NULL;
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index be0167e..b57b8ec 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -439,7 +439,8 @@ struct {
{ "LIST-EXTENDED", IMAPX_CAPABILITY_LIST_EXTENDED },
{ "LIST-STATUS", IMAPX_CAPABILITY_LIST_STATUS },
{ "QUOTA", IMAPX_CAPABILITY_QUOTA },
- { "MOVE", IMAPX_CAPABILITY_MOVE }
+ { "MOVE", IMAPX_CAPABILITY_MOVE },
+ { "NOTIFY", IMAPX_CAPABILITY_NOTIFY }
};
static GMutex capa_htable_lock; /* capabilities lookup table lock */
diff --git a/camel/camel-imapx-utils.h b/camel/camel-imapx-utils.h
index 9777898..c1d8a2b 100644
--- a/camel/camel-imapx-utils.h
+++ b/camel/camel-imapx-utils.h
@@ -186,7 +186,8 @@ enum {
IMAPX_CAPABILITY_LIST_STATUS = (1 << 10),
IMAPX_CAPABILITY_LIST_EXTENDED = (1 << 11),
IMAPX_CAPABILITY_QUOTA = (1 << 12),
- IMAPX_CAPABILITY_MOVE = (1 << 13)
+ IMAPX_CAPABILITY_MOVE = (1 << 13),
+ IMAPX_CAPABILITY_NOTIFY = (1 << 14)
};
struct _capability_info {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]