summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-12-08 01:10:32 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-12-08 01:10:32 +0000
commit4b154a643b4ef5a4448fd2e5b4d8e2e11d596eb5 (patch)
tree397291b7e8d108dc8fce3eb7cfe8ddf516b5f7d1 /usr.bin/tmux/server-client.c
parent124e67113db228290a9a8ff903f6eb4ab3b34e60 (diff)
Add hooks infrastructure, basic commands (set-hook, show-hooks) and a
couple of not very useful client hooks. This will eventually let commands be run at various points and on notifications. Joint work with Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 12d2a630d6a..22f90d93726 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.173 2015/12/01 09:41:03 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.174 2015/12/08 01:10:31 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -256,6 +256,19 @@ server_client_free(__unused int fd, __unused short events, void *arg)
free(c);
}
+/* Detach a client. */
+void
+server_client_detach(struct client *c, enum msgtype msgtype)
+{
+ struct session *s = c->session;
+
+ if (s == NULL)
+ return;
+
+ hooks_run(c->session->hooks, "client-detached", c);
+ proc_send_s(c->peer, msgtype, s->name);
+}
+
/* Check for mouse keys. */
key_code
server_client_check_mouse(struct client *c)
@@ -995,6 +1008,8 @@ server_client_dispatch(struct imsg *imsg, void *arg)
recalculate_sizes();
server_redraw_client(c);
}
+ if (c->session != NULL)
+ hooks_run(c->session->hooks, "client-resized", c);
break;
case MSG_EXITING:
if (datalen != 0)