Skip to content

Commit

Permalink
Use default parse machinery for event command
Browse files Browse the repository at this point in the history
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 uzbl#251
  • Loading branch information
keis committed Apr 8, 2016
1 parent fcbe5b7 commit bcc0cd9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bcc0cd9

Please sign in to comment.