[evolution-data-server] Bug 787542 - Fix search for exact phrase in body of mail on Gmail
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 787542 - Fix search for exact phrase in body of mail on Gmail
- Date: Mon, 18 Sep 2017 07:48:38 +0000 (UTC)
commit c24c113dbb1457dcbfd00a073a8e0874dc3afb62
Author: Milan Crha <mcrha redhat com>
Date: Mon Sep 18 09:47:36 2017 +0200
Bug 787542 - Fix search for exact phrase in body of mail on Gmail
src/camel/providers/imapx/camel-imapx-command.c | 13 +++++++++++++
src/camel/providers/imapx/camel-imapx-server.c | 18 +++++++++++++++++-
2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-command.c b/src/camel/providers/imapx/camel-imapx-command.c
index 7e9ec7f..74a72ac 100644
--- a/src/camel/providers/imapx/camel-imapx-command.c
+++ b/src/camel/providers/imapx/camel-imapx-command.c
@@ -271,7 +271,16 @@ camel_imapx_command_addv (CamelIMAPXCommand *ic,
if (mask & IMAPX_TYPE_ATOM_CHAR)
g_string_append (buffer, s);
else if (mask & IMAPX_TYPE_TEXT_CHAR) {
+ gboolean is_gmail_search = FALSE;
+
g_string_append_c (buffer, '"');
+ if (ic->job_kind == CAMEL_IMAPX_JOB_UID_SEARCH) {
+ is_gmail_search = g_str_has_prefix (format, "
X-GM-RAW");
+
+ if (is_gmail_search)
+ g_string_append (buffer, "\\\"");
+ }
+
while (*s) {
gchar *start = s;
@@ -284,6 +293,10 @@ camel_imapx_command_addv (CamelIMAPXCommand *ic,
s++;
}
}
+
+ if (is_gmail_search)
+ g_string_append (buffer, "\\\"");
+
g_string_append_c (buffer, '"');
} else {
camel_imapx_command_add_part (ic, CAMEL_IMAPX_COMMAND_STRING,
s);
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 76a3005..f64a0af 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -6120,8 +6120,24 @@ camel_imapx_server_uid_search_sync (CamelIMAPXServer *is,
camel_imapx_command_add (ic, " %t", criteria_prefix);
if (search_key && words) {
+ gboolean is_gmail_server = FALSE;
+
+ if (g_strcasecmp (search_key, "BODY") == 0) {
+ CamelIMAPXStore *imapx_store;
+
+ imapx_store = camel_imapx_server_ref_store (is);
+ if (imapx_store) {
+ is_gmail_server = camel_imapx_store_is_gmail_server (imapx_store);
+ g_object_unref (imapx_store);
+ }
+ }
+
for (ii = 0; words[ii]; ii++) {
- camel_imapx_command_add (ic, " %t %s", search_key, words[ii]);
+ guchar mask = is_gmail_server ? imapx_is_mask (words[ii]) : 0;
+ if (is_gmail_server && !(mask & IMAPX_TYPE_ATOM_CHAR) && (mask &
IMAPX_TYPE_TEXT_CHAR) != 0)
+ camel_imapx_command_add (ic, " X-GM-RAW %s", words[ii]);
+ else
+ camel_imapx_command_add (ic, " %t %s", search_key, words[ii]);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]