[evolution-data-server] I#2 - Confusing counts when downloading messages for offline
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] I#2 - Confusing counts when downloading messages for offline
- Date: Wed, 30 May 2018 12:49:27 +0000 (UTC)
commit 6973a876e240be804833a575c149fe03a4b7488e
Author: Milan Crha <mcrha redhat com>
Date: Wed May 30 14:49:24 2018 +0200
I#2 - Confusing counts when downloading messages for offline
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/2
src/camel/camel-offline-folder.c | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/src/camel/camel-offline-folder.c b/src/camel/camel-offline-folder.c
index 5e631d4c3..f0af9b77e 100644
--- a/src/camel/camel-offline-folder.c
+++ b/src/camel/camel-offline-folder.c
@@ -429,28 +429,43 @@ offline_folder_downsync_sync (CamelOfflineFolder *offline,
camel_service_get_display_name (CAMEL_SERVICE (camel_folder_get_parent_store (folder))),
camel_folder_get_full_name (folder));
- if (expression)
+ limit_time = offline_folder_get_limit_time (folder);
+ if (limit_time > 0 && camel_folder_get_folder_summary (folder)) {
+ gchar *search_sexp;
+
+ camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
+
+ /* Also used to know what function to use to free the 'uids' array below */
+ if (!expression)
+ expression = "";
+
+ search_sexp = g_strdup_printf ("(match-all (and "
+ "%s "
+ "(> (get-sent-date) %" G_GINT64_FORMAT ")"
+ "))", expression, (gint64) limit_time);
+
+ uids = camel_folder_search_by_expression (folder, search_sexp, cancellable, NULL);
+
+ g_free (search_sexp);
+ } else if (expression) {
uids = camel_folder_search_by_expression (folder, expression, cancellable, NULL);
- else
+ } else {
uids = camel_folder_get_uids (folder);
+ }
if (!uids)
goto done;
+
uncached_uids = camel_folder_get_uncached_uids (folder, uids, NULL);
- if (uids) {
- if (expression)
- camel_folder_search_free (folder, uids);
- else
- camel_folder_free_uids (folder, uids);
- }
+
+ if (expression)
+ camel_folder_search_free (folder, uids);
+ else
+ camel_folder_free_uids (folder, uids);
if (!uncached_uids)
goto done;
- limit_time = offline_folder_get_limit_time (folder);
- if (limit_time > 0 && camel_folder_get_folder_summary (folder))
- camel_folder_summary_prepare_fetch_all (camel_folder_get_folder_summary (folder), NULL);
-
for (i = 0; i < uncached_uids->len && !g_cancellable_is_cancelled (cancellable); i++) {
const gchar *uid = uncached_uids->pdata[i];
gboolean download = limit_time <= 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]