[evolution-data-server/gnome-2-32] Fix QRESYNC protocol violation (RH #648082)
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-32] Fix QRESYNC protocol violation (RH #648082)
- Date: Thu, 11 Nov 2010 14:16:44 +0000 (UTC)
commit e02cb9580773e0aa7a109a25c17ceeffe54ec5bc
Author: David Woodhouse <David Woodhouse intel com>
Date: Thu Nov 11 01:34:18 2010 +0000
Fix QRESYNC protocol violation (RH #648082)
The sequence-set '1:*' isn't valid in QRESYNC, and newer versions of
Dovecot (>=2.0) have started to object to it.
Ideally we'd omit the parameter completely, since it's supposed to be
optional â?? but *older* versions of Dovecot (<=1.2.13) require it.
We only really care about messages which we already knew about. For any
*new* messages, we're going to fetch the headers and the flags in an
explicit FETCH command anyway, and we'll ignore anything that QRESYNC
tells us about them. So just use the first and last UID from our existing
summary cache as the range for the QRESYNC command.
Fix a shadow declaration of the 'uid' variable in an inner block, while
we're at it.
camel/providers/imapx/camel-imapx-server.c | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index fef2c73..cd706f6 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2551,15 +2551,28 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, GError
if (is->use_qresync) {
CamelIMAPXSummary *isum = (CamelIMAPXSummary *)folder->summary;
CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *)folder;
- gint total = camel_folder_summary_count(folder->summary);
- gchar *uid = NULL;
+ gint total = camel_folder_summary_count (folder->summary);
+ gchar *firstuid = NULL, *lastuid = NULL;
- if (total)
- uid = camel_folder_summary_uid_from_index (folder->summary, 0);
+ if (total) {
+ firstuid = camel_folder_summary_uid_from_index (folder->summary, 0);
+ lastuid = camel_folder_summary_uid_from_index (folder->summary, total - 1);
+ }
if (isum->modseq && ifolder->uidvalidity_on_server) {
- c(printf("SELECT QRESYNC %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT "\n", ifolder->uidvalidity_on_server, isum->modseq));
- camel_imapx_command_add(ic, " (QRESYNC (%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %s:*", ifolder->uidvalidity_on_server, isum->modseq, uid?uid:"1");
+ c(printf("SELECT QRESYNC %" G_GUINT64_FORMAT
+ " %" G_GUINT64_FORMAT "\n",
+ ifolder->uidvalidity_on_server, isum->modseq));
+ camel_imapx_command_add(ic, " (QRESYNC (%"
+ G_GUINT64_FORMAT " %"
+ G_GUINT64_FORMAT " %s:%s",
+ ifolder->uidvalidity_on_server,
+ isum->modseq,
+ firstuid?firstuid:"1",
+ lastuid?lastuid:"1");
+
+ g_free (firstuid);
+ g_free (lastuid);
if (total > 10) {
gint i;
@@ -2607,7 +2620,6 @@ imapx_select (CamelIMAPXServer *is, CamelFolder *folder, gboolean forced, GError
}
camel_imapx_command_add(ic, "))");
}
- g_free(uid);
}
ic->complete = imapx_command_select_done;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]