diff --git a/tmate-decoder.c b/tmate-decoder.c index 570f5f9c..46948e81 100644 --- a/tmate-decoder.c +++ b/tmate-decoder.c @@ -206,6 +206,27 @@ static void tmate_pty_data(struct tmate_unpacker *uk) wp->window->flags |= WINDOW_SILENCE; } +static void tmate_cmd(struct tmate_unpacker *uk) +{ + struct cmd_q *cmd_q; + struct cmd_list *cmdlist; + char *cmd_str; + char *cause; + + cmd_str = unpack_string(uk); + if (cmd_string_parse(cmd_str, &cmdlist, NULL, 0, &cause) != 0) { + free(cause); + goto out; + } + + cmd_q = cmdq_new(NULL); + cmdq_run(cmd_q, cmdlist); + cmd_list_free(cmdlist); + cmdq_free(cmd_q); +out: + free(cmd_str); +} + static void handle_message(msgpack_object obj) { struct tmate_unpacker _uk; @@ -218,6 +239,7 @@ static void handle_message(msgpack_object obj) case TMATE_HEADER: tmate_header(uk); break; case TMATE_SYNC_WINDOW: tmate_sync_window(uk); break; case TMATE_PTY_DATA: tmate_pty_data(uk); break; + case TMATE_CMD: tmate_cmd(uk); break; default: decoder_error(); } } diff --git a/tmate-encoder.c b/tmate-encoder.c index d85ffe80..9f4776bd 100644 --- a/tmate-encoder.c +++ b/tmate-encoder.c @@ -50,6 +50,10 @@ void tmate_client_pane_key(int pane_id, int key) } static const struct cmd_entry *local_cmds[] = { + &cmd_bind_key_entry, + &cmd_unbind_key_entry, + &cmd_set_option_entry, + &cmd_set_window_option_entry, &cmd_detach_client_entry, &cmd_attach_session_entry, NULL diff --git a/tmate.h b/tmate.h index 34099217..f01419e5 100644 --- a/tmate.h +++ b/tmate.h @@ -46,6 +46,7 @@ enum tmate_commands { TMATE_HEADER, TMATE_SYNC_WINDOW, TMATE_PTY_DATA, + TMATE_CMD, }; #define TMATE_PANE_ACTIVE 1