* fix searching for strings with spaces (e.g. maildir:"sent items")

This commit is contained in:
djcb
2011-11-24 00:12:29 +02:00
parent cc6738c195
commit c9f72ba3c7
5 changed files with 118 additions and 69 deletions

View File

@ -294,6 +294,35 @@ resolve_bookmark (MuConfig *opts, GError **err)
}
gchar*
str_quoted_from_strv (const gchar **params)
{
GString *str;
int i;
g_return_val_if_fail (params, NULL);
if (!params[0])
return g_strdup ("");
str = g_string_sized_new (64); /* just a guess */
for (i = 0; params[i]; ++i) {
if (i > 0)
g_string_append_c (str, ' ');
g_string_append_c (str, '"');
g_string_append (str, params[i]);
g_string_append_c (str, '"');
}
return g_string_free (str, FALSE);
}
static gchar*
get_query (MuConfig *opts, GError **err)
{
@ -313,7 +342,7 @@ get_query (MuConfig *opts, GError **err)
return NULL;
}
query = mu_util_str_from_strv ((const gchar**)&opts->params[1]);
query = str_quoted_from_strv ((const gchar**)&opts->params[1]);
if (bookmarkval) {
gchar *tmp;
tmp = g_strdup_printf ("%s %s", bookmarkval, query);