From bcc0cd9a5107242439c156ac15ff70d1e066f807 Mon Sep 17 00:00:00 2001 From: David Keijser Date: Fri, 8 Apr 2016 09:06:40 +0200 Subject: [PATCH] Use default parse machinery for event command This allows us to send the data as quoted strings rather than pass them through raw which has the side effect of dropping a level of escapes due to the earlier pass done in uzbl-core. Ref #251 --- src/commands.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/commands.c b/src/commands.c index 5daadc904..5a1042b52 100644 --- a/src/commands.c +++ b/src/commands.c @@ -715,7 +715,7 @@ builtin_command_table[] = { { "print", cmd_print, FALSE, TRUE }, /* Event commands */ - { "event", cmd_event, FALSE, FALSE }, + { "event", cmd_event, TRUE, FALSE }, { "choose", cmd_choose, TRUE, TRUE }, { "request", cmd_request, TRUE, TRUE }, @@ -2240,22 +2240,22 @@ IMPLEMENT_COMMAND (event) ARG_CHECK (argv, 1); - gchar **split = g_strsplit (argv_idx (argv, 0), " ", 2); - - const gchar *event = split[0]; - const gchar *arg_string = split[1]; + const gchar *event = argv_idx (argv, 0); if (event) { GString *event_name = g_string_ascii_up (g_string_new (event)); + GArray *event_args = g_array_new (TRUE, FALSE, sizeof (gchar *)); + g_array_insert_vals (event_args, 0, + &g_array_index (argv, char *, 1), + argv->len - 1); uzbl_events_send (USER_EVENT, event_name->str, - TYPE_FORMATTEDSTR, arg_string ? arg_string : "", - NULL); + TYPE_STR_ARRAY, event_args, + NULL); + g_array_free (event_args, FALSE); g_string_free (event_name, TRUE); } - - g_strfreev (split); } static void