From 4ee8c5e1d6e01f74fc96d72bee88bf4710a4b58a Mon Sep 17 00:00:00 2001 From: djcb Date: Sat, 28 Oct 2017 18:23:08 +0300 Subject: [PATCH] mu4e: work around quoting issues Use base-64 for now. --- mu/mu-cmd-server.c | 12 +++++++++++- mu4e/mu4e-proc.el | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mu/mu-cmd-server.c b/mu/mu-cmd-server.c index 5e72da6c..8d95021e 100644 --- a/mu/mu-cmd-server.c +++ b/mu/mu-cmd-server.c @@ -949,6 +949,7 @@ cmd_find (ServerContext *ctx, GHashTable *args, GError **err) MuMsgFieldId sortfield; const char *querystr; MuQueryFlags qflags; + char *query; GET_STRING_OR_ERROR_RETURN (args, "query", &querystr, err); if (get_find_params (args, &sortfield, &maxnum, &qflags, err) @@ -957,12 +958,21 @@ cmd_find (ServerContext *ctx, GHashTable *args, GError **err) return MU_OK; } + { + char *s; + gsize len; + s = (char*)g_base64_decode (querystr, &len); + query = g_strndup (s, len); + g_free (s); + } + /* note: when we're threading, we get *all* matching messages, * and then only return maxnum; this is so that we maximimize * the change of all messages in a thread showing up */ - iter = mu_query_run (ctx->query, querystr, sortfield, + iter = mu_query_run (ctx->query, query, sortfield, maxnum, qflags, err); + g_free (query); if (!iter) { print_and_clear_g_error (err); return MU_OK; diff --git a/mu4e/mu4e-proc.el b/mu4e/mu4e-proc.el index 61812f06..ffa38f61 100644 --- a/mu4e/mu4e-proc.el +++ b/mu4e/mu4e-proc.el @@ -339,7 +339,7 @@ or an error." (concat "cmd:find query:%s threads:%s sortfield:%s reverse:%s maxnum:%d " "skip-dups:%s include-related:%s") - (format "%s" query) + (base64-encode-string query) (if threads "true" "false") ;; sortfield is e.g. ':subject'; this removes the ':' (if (null sortfield) "nil" (substring (symbol-name sortfield) 1))