diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-12-17 00:01:08 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-12-17 00:01:08 +0000 |
commit | e0cae08c04a1adca313ec94b7557496142cc2173 (patch) | |
tree | b46acbb209ba4514de75ce8aafe2163f1f97048b /hooks.c | |
parent | 7c94dae702798db66424897159a44832f5dbc392 (diff) | |
parent | 99e9a4c7864c188857fe57b411312ee669f16b54 (diff) | |
download | rtmux-e0cae08c04a1adca313ec94b7557496142cc2173.tar.gz rtmux-e0cae08c04a1adca313ec94b7557496142cc2173.tar.bz2 rtmux-e0cae08c04a1adca313ec94b7557496142cc2173.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'hooks.c')
-rw-r--r-- | hooks.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -43,6 +43,14 @@ hooks_cmp(struct hook *hook1, struct hook *hook2) } struct hooks * +hooks_get(struct session *s) +{ + if (s != NULL) + return (s->hooks); + return (global_hooks); +} + +struct hooks * hooks_create(struct hooks *parent) { struct hooks *hooks; @@ -148,7 +156,8 @@ hooks_emptyfn(struct cmd_q *hooks_cmdq) } int -hooks_run(struct hooks *hooks, struct client *c, const char *fmt, ...) +hooks_run(struct hooks *hooks, struct client *c, struct cmd_find_state *fs, + const char *fmt, ...) { struct hook *hook; struct cmd_q *hooks_cmdq; @@ -169,6 +178,9 @@ hooks_run(struct hooks *hooks, struct client *c, const char *fmt, ...) hooks_cmdq = cmdq_new(c); hooks_cmdq->flags |= CMD_Q_NOHOOKS; + + if (fs != NULL) + cmd_find_copy_state(&hooks_cmdq->current, fs); hooks_cmdq->parent = NULL; cmdq_run(hooks_cmdq, hook->cmdlist, NULL); @@ -177,7 +189,8 @@ hooks_run(struct hooks *hooks, struct client *c, const char *fmt, ...) } int -hooks_wait(struct hooks *hooks, struct cmd_q *cmdq, const char *fmt, ...) +hooks_wait(struct hooks *hooks, struct cmd_q *cmdq, struct cmd_find_state *fs, + const char *fmt, ...) { struct hook *hook; struct cmd_q *hooks_cmdq; @@ -198,6 +211,9 @@ hooks_wait(struct hooks *hooks, struct cmd_q *cmdq, const char *fmt, ...) hooks_cmdq = cmdq_new(cmdq->client); hooks_cmdq->flags |= CMD_Q_NOHOOKS; + + if (fs != NULL) + cmd_find_copy_state(&hooks_cmdq->current, fs); hooks_cmdq->parent = cmdq; hooks_cmdq->emptyfn = hooks_emptyfn; |