evolution-data-server r9164 - trunk/camel
- From: psankar svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9164 - trunk/camel
- Date: Mon, 21 Jul 2008 15:26:28 +0000 (UTC)
Author: psankar
Date: Mon Jul 21 15:26:28 2008
New Revision: 9164
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9164&view=rev
Log:
2008-07-22 Sankar P <psankar novell com>
* camel-folder-search.c (check_header), (search_system_flag):
Make search work and don't screw up when the system flags are included.
A better sexp parser is coming up.
Modified:
trunk/camel/ChangeLog
trunk/camel/camel-folder-search.c
Modified: trunk/camel/camel-folder-search.c
==============================================================================
--- trunk/camel/camel-folder-search.c (original)
+++ trunk/camel/camel-folder-search.c Mon Jul 21 15:26:28 2008
@@ -933,6 +933,14 @@
return r;
}
+/*
+static void
+l_printf(char *node)
+{
+printf("%s\t", node);
+}
+*/
+
static ESExpResult *
check_header (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search, camel_search_match_t how)
{
@@ -970,9 +978,14 @@
if (g_str_has_suffix (search->query->str, " "))
g_string_append_printf (search->query, "WHERE %s LIKE %s", column, value);
else {
- if (f->operators)
- g_string_append_printf (search->query, " %s %s LIKE %s", (char *) (g_slist_nth_data (f->operators, 0)), column, value);
- else
+ if (f->operators) {
+ /*g_slist_foreach (f->operators, l_printf, NULL);
+ printf(" \n");*/
+
+ g_string_append_printf (search->query, " %s %s LIKE %s", (char *) (g_slist_nth_data (f->operators, (g_slist_length (f->operators) - 2))), column, value);
+ f->operators = g_slist_remove_link (f->operators, (g_slist_nth (f->operators, (g_slist_length (f->operators) - 2))));
+
+ } else
g_string_append_printf (search->query, " OR %s LIKE %s", column, value);
}
@@ -1381,11 +1394,21 @@
if (g_str_has_suffix (search->query->str, " "))
g_string_append_printf (search->query, "WHERE (%s %s 0)", value, connector);
else {
- search->query->len -= 1;
- if (f->operators)
- g_string_append_printf (search->query, " %s %s %s 0)", (char *) (g_slist_nth_data (f->operators, 0)), value, connector);
+ gboolean flag = FALSE;
+ if (search->query->str [search->query->len - 1] == ')') {
+ search->query->len -= 1;
+ flag = TRUE;
+ }
+
+ if (f->operators) {
+ g_string_append_printf (search->query, " %s %s %s 0", (char *) (g_slist_nth_data (f->operators, 0)), value, connector);
+ }
else
g_string_append_printf (search->query, " OR %s %s 0", value, connector);
+
+
+ if (flag)
+ g_string_append (search->query,")");
}
g_free (value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]