Spacing/style nits.

This commit is contained in:
nicm
2022-05-30 12:55:25 +00:00
parent af611815ea
commit 0a8f356c72
12 changed files with 218 additions and 16 deletions

View File

@ -2775,6 +2775,14 @@ server_client_dispatch(struct imsg *imsg, void *arg)
}
}
/* Callback when command is not allowed. */
static enum cmd_retval
server_client_read_only(struct cmdq_item *item, __unused void *data)
{
cmdq_error(item, "client is read-only");
return (CMD_RETURN_ERROR);
}
/* Callback when command is done. */
static enum cmd_retval
server_client_command_done(struct cmdq_item *item, __unused void *data)
@ -2799,6 +2807,7 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
char **argv, *cause;
struct cmd_parse_result *pr;
struct args_value *values;
struct cmdq_item *new_item;
if (c->flags & CLIENT_EXIT)
return;
@ -2837,7 +2846,12 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
free(values);
cmd_free_argv(argc, argv);
cmdq_append(c, cmdq_get_command(pr->cmdlist, NULL));
if ((c->flags & CLIENT_READONLY) &&
!cmd_list_all_have(pr->cmdlist, CMD_READONLY))
new_item = cmdq_get_callback(server_client_read_only, NULL);
else
new_item = cmdq_get_command(pr->cmdlist, NULL);
cmdq_append(c, new_item);
cmdq_append(c, cmdq_get_callback(server_client_command_done, NULL));
cmd_list_free(pr->cmdlist);
@ -3071,9 +3085,11 @@ server_client_set_flags(struct client *c, const char *flags)
continue;
log_debug("client %s set flag %s", c->name, next);
if (not)
if (not) {
if (c->flags & CLIENT_READONLY)
flag &= ~CLIENT_READONLY;
c->flags &= ~flag;
else
} else
c->flags |= flag;
if (flag == CLIENT_CONTROL_NOOUTPUT)
control_reset_offsets(c);
@ -3141,7 +3157,7 @@ server_client_add_client_window(struct client *c, u_int id)
cw->window = id;
RB_INSERT(client_windows, &c->windows, cw);
}
return cw;
return (cw);
}
/* Get client active pane. */