[evolution-data-server/gnome-3-34] evo-I#686 - Broken search folder that includes all mails from other search folders
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-34] evo-I#686 - Broken search folder that includes all mails from other search folders
- Date: Tue, 28 Jan 2020 11:46:28 +0000 (UTC)
commit 6af039fb36ba9b6e77269652c0b4d080f3723964
Author: Milan Crha <mcrha redhat com>
Date: Tue Jan 28 12:46:06 2020 +0100
evo-I#686 - Broken search folder that includes all mails from other search folders
Closes https://gitlab.gnome.org/GNOME/evolution/issues/686
src/camel/camel-vee-folder.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
---
diff --git a/src/camel/camel-vee-folder.c b/src/camel/camel-vee-folder.c
index 4068aca85..6092644e0 100644
--- a/src/camel/camel-vee-folder.c
+++ b/src/camel/camel-vee-folder.c
@@ -845,6 +845,25 @@ vee_folder_add_subfolder_uids_to_search_matches (CamelVeeDataCache *data_cache,
}
}
+static const gchar *
+vee_folder_combine_expressions (CamelVeeFolder *vfolder,
+ const gchar *expression,
+ gchar **tmp)
+{
+ const gchar *my_expression;
+
+ my_expression = camel_vee_folder_get_expression (vfolder);
+
+ if (!expression || !*expression) {
+ expression = my_expression;
+ } else if (my_expression && *my_expression) {
+ *tmp = g_strconcat ("(and ", expression, " ", my_expression, ")", NULL);
+ expression = *tmp;
+ }
+
+ return expression;
+}
+
static GPtrArray *
vee_folder_search_by_expression (CamelFolder *folder,
const gchar *expression,
@@ -855,6 +874,7 @@ vee_folder_search_by_expression (CamelFolder *folder,
CamelVeeDataCache *data_cache;
GPtrArray *matches = NULL;
GList *link;
+ gchar *tmp = NULL;
g_return_val_if_fail (CAMEL_IS_VEE_FOLDER (folder), NULL);
@@ -863,6 +883,8 @@ vee_folder_search_by_expression (CamelFolder *folder,
g_rec_mutex_lock (&vfolder->priv->subfolder_lock);
+ expression = vee_folder_combine_expressions (vfolder, expression, &tmp);
+
for (link = vfolder->priv->subfolders; link && !g_cancellable_is_cancelled (cancellable); link =
g_list_next (link)) {
CamelFolder *subfolder = link->data;
GPtrArray *submatches;
@@ -881,6 +903,8 @@ vee_folder_search_by_expression (CamelFolder *folder,
}
}
+ g_free (tmp);
+
g_rec_mutex_unlock (&vfolder->priv->subfolder_lock);
if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
@@ -947,6 +971,7 @@ vee_folder_search_by_uids (CamelFolder *folder,
GPtrArray *matches = NULL;
GList *link;
guint ii;
+ gchar *tmp = NULL;
g_return_val_if_fail (CAMEL_IS_VEE_FOLDER (folder), NULL);
@@ -977,6 +1002,8 @@ vee_folder_search_by_uids (CamelFolder *folder,
g_rec_mutex_lock (&vfolder->priv->subfolder_lock);
+ expression = vee_folder_combine_expressions (vfolder, expression, &tmp);
+
for (link = vfolder->priv->subfolders; link && !g_cancellable_is_cancelled (cancellable); link =
g_list_next (link)) {
CamelFolder *subfolder = link->data;
GPtrArray *submatches, *subuids;
@@ -1009,6 +1036,8 @@ vee_folder_search_by_uids (CamelFolder *folder,
}
}
+ g_free (tmp);
+
g_rec_mutex_unlock (&vfolder->priv->subfolder_lock);
if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
@@ -1033,6 +1062,7 @@ vee_folder_count_by_expression (CamelFolder *folder,
{
CamelVeeFolder *vfolder;
GList *link;
+ gchar *tmp = NULL;
guint32 count = 0;
g_return_val_if_fail (CAMEL_IS_VEE_FOLDER (folder), 0);
@@ -1041,12 +1071,16 @@ vee_folder_count_by_expression (CamelFolder *folder,
g_rec_mutex_lock (&vfolder->priv->subfolder_lock);
+ expression = vee_folder_combine_expressions (vfolder, expression, &tmp);
+
for (link = vfolder->priv->subfolders; link && !g_cancellable_is_cancelled (cancellable); link =
g_list_next (link)) {
CamelFolder *subfolder = link->data;
count += camel_folder_count_by_expression (subfolder, expression, cancellable, NULL);
}
+ g_free (tmp);
+
g_rec_mutex_unlock (&vfolder->priv->subfolder_lock);
if (g_cancellable_set_error_if_cancelled (cancellable, error))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]