Mark control commands specially so the client can identify them, based

on a diff from George Nachman a while back.
This commit is contained in:
Nicholas Marriott 2013-06-23 12:41:54 +00:00 committed by Thomas Adam
parent 1099442c0a
commit a0172a6ae5
2 changed files with 8 additions and 2 deletions

View File

@ -157,14 +157,17 @@ int
cmdq_guard(struct cmd_q *cmdq, const char *guard)
{
struct client *c = cmdq->client;
int flags;
if (c == NULL)
return 0;
if (!(c->flags & CLIENT_CONTROL))
return 0;
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u\n", guard,
(long) cmdq->time, cmdq->number);
flags = !!(cmdq->cmd->flags & CMD_CONTROL);
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u %d\n", guard,
(long) cmdq->time, cmdq->number, flags);
server_push_stdout(c);
return 1;
}

View File

@ -55,6 +55,7 @@ control_callback(struct client *c, int closed, unused void *data)
{
char *line, *cause;
struct cmd_list *cmdlist;
struct cmd *cmd;
if (closed)
c->flags |= CLIENT_EXIT;
@ -78,6 +79,8 @@ control_callback(struct client *c, int closed, unused void *data)
free(cause);
} else {
TAILQ_FOREACH(cmd, &cmdlist->list, qentry)
cmd->flags |= CMD_CONTROL;
cmdq_run(c->cmdq, cmdlist);
cmd_list_free(cmdlist);
}