1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Replication of bind/unbind commands

This commit is contained in:
Nicolas Viennot 2013-06-11 22:45:50 -04:00
parent 77c23c7123
commit 1cc80546f4
3 changed files with 27 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -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

View File

@ -46,6 +46,7 @@ enum tmate_commands {
TMATE_HEADER,
TMATE_SYNC_WINDOW,
TMATE_PTY_DATA,
TMATE_CMD,
};
#define TMATE_PANE_ACTIVE 1