version 1.3, 2015/12/15 13:43:07 |
version 1.4, 2015/12/16 21:50:37 |
|
|
} |
} |
|
|
struct hooks * |
struct hooks * |
|
hooks_get(struct session *s) |
|
{ |
|
if (s != NULL) |
|
return (s->hooks); |
|
return (global_hooks); |
|
} |
|
|
|
struct hooks * |
hooks_create(struct hooks *parent) |
hooks_create(struct hooks *parent) |
{ |
{ |
struct hooks *hooks; |
struct hooks *hooks; |
|
|
} |
} |
|
|
int |
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 hook *hook; |
struct cmd_q *hooks_cmdq; |
struct cmd_q *hooks_cmdq; |
|
|
|
|
hooks_cmdq = cmdq_new(c); |
hooks_cmdq = cmdq_new(c); |
hooks_cmdq->flags |= CMD_Q_NOHOOKS; |
hooks_cmdq->flags |= CMD_Q_NOHOOKS; |
|
|
|
if (fs != NULL) |
|
cmd_find_copy_state(&hooks_cmdq->current, fs); |
hooks_cmdq->parent = NULL; |
hooks_cmdq->parent = NULL; |
|
|
cmdq_run(hooks_cmdq, hook->cmdlist, NULL); |
cmdq_run(hooks_cmdq, hook->cmdlist, NULL); |
|
|
} |
} |
|
|
int |
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 hook *hook; |
struct cmd_q *hooks_cmdq; |
struct cmd_q *hooks_cmdq; |
|
|
|
|
hooks_cmdq = cmdq_new(cmdq->client); |
hooks_cmdq = cmdq_new(cmdq->client); |
hooks_cmdq->flags |= CMD_Q_NOHOOKS; |
hooks_cmdq->flags |= CMD_Q_NOHOOKS; |
|
|
|
if (fs != NULL) |
|
cmd_find_copy_state(&hooks_cmdq->current, fs); |
hooks_cmdq->parent = cmdq; |
hooks_cmdq->parent = cmdq; |
|
|
hooks_cmdq->emptyfn = hooks_emptyfn; |
hooks_cmdq->emptyfn = hooks_emptyfn; |