From d2fb0efcd197bf0d581a0f7b1e27223d095cb339 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 8 Dec 2015 01:10:31 +0000 Subject: 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. --- server-client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server-client.c') diff --git a/server-client.c b/server-client.c index d2abd356..c948e980 100644 --- a/server-client.c +++ b/server-client.c @@ -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) -- cgit