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.
This commit is contained in:
nicm
2015-12-08 01:10:31 +00:00
parent dbfce2a4d8
commit d2fb0efcd1
11 changed files with 364 additions and 13 deletions

View File

@ -72,9 +72,8 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
TAILQ_FOREACH(cloop, &clients, entry) {
if (cloop->session != s)
continue;
proc_send_s(cloop->peer, msgtype, cloop->session->name);
if (cloop->session == s)
server_client_detach(cloop, msgtype);
}
return (CMD_RETURN_STOP);
}
@ -85,13 +84,12 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(args, 'a')) {
TAILQ_FOREACH(cloop, &clients, entry) {
if (cloop->session == NULL || cloop == c)
continue;
proc_send_s(cloop->peer, msgtype, cloop->session->name);
if (cloop->session != NULL && cloop != c)
server_client_detach(cloop, msgtype);
}
return (CMD_RETURN_NORMAL);
}
proc_send_s(c->peer, msgtype, c->session->name);
server_client_detach(c, msgtype);
return (CMD_RETURN_STOP);
}