[evolution-data-server/gnome-3-22] [IMAPx] Avoid unneeded full flags folder update when no changes made
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-22] [IMAPx] Avoid unneeded full flags folder update when no changes made
- Date: Fri, 10 Feb 2017 15:45:29 +0000 (UTC)
commit f153b7560f5559aa46a6c5618e971c784bbe862b
Author: Milan Crha <mcrha redhat com>
Date: Fri Feb 10 16:46:53 2017 +0100
[IMAPx] Avoid unneeded full flags folder update when no changes made
There had been a check whether folder content changed, but the current
values were not properly saved and also the UNSEEN response from the SELECT
command was used like being a number of unseen messages, but it's
a sequence number of the first unseen message instead.
camel/providers/imapx/camel-imapx-server.c | 26 +++++++++++++++++++-------
camel/providers/imapx/camel-imapx-utils.c | 5 ++++-
camel/providers/imapx/camel-imapx-utils.h | 1 +
3 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 09735fa..fc162b7 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1775,7 +1775,7 @@ imapx_untagged_ok_no_bad (CamelIMAPXServer *is,
is->priv->context->sinfo = imapx_parse_status (
CAMEL_IMAPX_INPUT_STREAM (input_stream),
- mailbox, cancellable, error);
+ mailbox, TRUE, cancellable, error);
g_clear_object (&mailbox);
@@ -2366,7 +2366,7 @@ imapx_completion (CamelIMAPXServer *is,
ic->status = imapx_parse_status (
CAMEL_IMAPX_INPUT_STREAM (input_stream),
- mailbox, cancellable, error);
+ mailbox, FALSE, cancellable, error);
g_clear_object (&mailbox);
@@ -5084,7 +5084,6 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
}
if (is->priv->use_qresync && imapx_summary->modseq > 0 && uidvalidity > 0) {
- imapx_summary->modseq = highestmodseq;
if (total != messages ||
camel_folder_summary_get_unread_count (folder->summary) != unseen ||
imapx_summary->modseq != highestmodseq) {
@@ -5099,6 +5098,12 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
imapx_summary->modseq,
highestmodseq);
} else {
+ imapx_summary->uidnext = uidnext;
+
+ camel_folder_summary_touch (folder->summary);
+ camel_folder_summary_save_to_db (folder->summary, NULL);
+ imapx_update_store_summary (folder);
+
c (
is->priv->tagprefix,
"OK, after QRESYNC we're still in sync. "
@@ -5135,6 +5140,13 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
if (success && uidl != 1)
success = imapx_server_fetch_changes (is, mailbox, folder, known_uids, 0, uidl, cancellable,
error);
+ if (success) {
+ imapx_summary->modseq = highestmodseq;
+ imapx_summary->uidnext = uidnext;
+
+ camel_folder_summary_touch (folder->summary);
+ }
+
g_mutex_lock (&is->priv->changes_lock);
changes = is->priv->changes;
@@ -5175,11 +5187,11 @@ camel_imapx_server_refresh_info_sync (CamelIMAPXServer *is,
camel_folder_summary_free_array (array);
}
- if (camel_folder_change_info_changed (changes)) {
- camel_folder_summary_save_to_db (folder->summary, NULL);
- imapx_update_store_summary (folder);
+ camel_folder_summary_save_to_db (folder->summary, NULL);
+ imapx_update_store_summary (folder);
+
+ if (camel_folder_change_info_changed (changes))
camel_folder_changed (folder, changes);
- }
camel_folder_change_info_free (changes);
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index e94e123..4fe0a77 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -2391,6 +2391,7 @@ imapx_parse_status_unseen (CamelIMAPXInputStream *stream,
struct _status_info *
imapx_parse_status (CamelIMAPXInputStream *stream,
CamelIMAPXMailbox *mailbox,
+ gboolean is_ok_no_bad,
GCancellable *cancellable,
GError **error)
{
@@ -2503,7 +2504,9 @@ imapx_parse_status (CamelIMAPXInputStream *stream,
break;
case IMAPX_UNSEEN:
- success = imapx_parse_status_unseen (
+ /* Ignore UNSEEN in OK/NO/BAD, because it's not count of unseen
+ messages, but the sequence number of the first unseen message. */
+ success = is_ok_no_bad || imapx_parse_status_unseen (
stream, mailbox, cancellable, error);
break;
diff --git a/camel/providers/imapx/camel-imapx-utils.h b/camel/providers/imapx/camel-imapx-utils.h
index 7fc055b..105a1e3 100644
--- a/camel/providers/imapx/camel-imapx-utils.h
+++ b/camel/providers/imapx/camel-imapx-utils.h
@@ -300,6 +300,7 @@ struct _status_info {
struct _status_info *
imapx_parse_status (CamelIMAPXInputStream *stream,
CamelIMAPXMailbox *mailbox,
+ gboolean is_ok_no_bad,
GCancellable *cancellable,
GError **error);
struct _status_info *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]