Notification messages

This commit is contained in:
Nicolas Viennot 2013-06-13 04:31:25 -04:00
parent edd194c23c
commit a50dcb09b5
3 changed files with 7 additions and 8 deletions

View File

@ -74,12 +74,11 @@ static char *unpack_string(struct tmate_unpacker *uk)
return alloc_buf; return alloc_buf;
} }
static void tmate_reply_header(struct tmate_unpacker *uk) static void tmate_notify(struct tmate_unpacker *uk)
{ {
unsigned long flags = unpack_int(uk); char *msg = unpack_string(uk);
char *remote_session = unpack_string(uk); tmate_status_message("%s", msg);
free(msg);
tmate_status_message("Remote session: %s", remote_session);
} }
static void tmate_client_pane_key(struct tmate_unpacker *uk) static void tmate_client_pane_key(struct tmate_unpacker *uk)
@ -157,7 +156,7 @@ static void handle_message(msgpack_object obj)
init_unpacker(uk, obj); init_unpacker(uk, obj);
switch (unpack_int(uk)) { switch (unpack_int(uk)) {
case TMATE_REPLY_HEADER: tmate_reply_header(uk); break; case TMATE_NOTIFY: tmate_notify(uk); break;
case TMATE_CLIENT_PANE_KEY: tmate_client_pane_key(uk); break; case TMATE_CLIENT_PANE_KEY: tmate_client_pane_key(uk); break;
case TMATE_CLIENT_RESIZE: tmate_client_resize(uk); break; case TMATE_CLIENT_RESIZE: tmate_client_resize(uk); break;
case TMATE_CLIENT_EXEC_CMD: tmate_client_exec_cmd(uk); break; case TMATE_CLIENT_EXEC_CMD: tmate_client_exec_cmd(uk); break;

View File

@ -16,7 +16,7 @@ static void tmate_status_message_client(struct client *c, const char *message)
status_prompt_clear(c); status_prompt_clear(c);
status_message_clear(c); status_message_clear(c);
xasprintf(&c->message_string, "tmate: %s", message); xasprintf(&c->message_string, "[tmate] %s", message);
ARRAY_EXPAND(&c->message_log, 1); ARRAY_EXPAND(&c->message_log, 1);
msg = &ARRAY_LAST(&c->message_log); msg = &ARRAY_LAST(&c->message_log);

View File

@ -48,7 +48,7 @@ extern void tmate_sync_copy_mode(struct window_pane *wp);
/* tmate-decoder.c */ /* tmate-decoder.c */
enum tmate_client_commands { enum tmate_client_commands {
TMATE_REPLY_HEADER, TMATE_NOTIFY,
TMATE_CLIENT_PANE_KEY, TMATE_CLIENT_PANE_KEY,
TMATE_CLIENT_RESIZE, TMATE_CLIENT_RESIZE,
TMATE_CLIENT_EXEC_CMD, TMATE_CLIENT_EXEC_CMD,