summaryrefslogtreecommitdiffstats
path: root/cmd-set-option.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-04 05:47:46 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-04 05:47:46 +0000
commit031be1fc7283bd400ff60b216a38fa734415ca15 (patch)
tree0e97b56fbcdf71911404a3c2364eb1dd6fc1afdb /cmd-set-option.c
parent811e75da52a0b504db4221df4504d3594ba3cb8b (diff)
Don't crash when looking at NULL clients; also redraw everything on status change.
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r--cmd-set-option.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 49aac0d7..8826a657 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.20 2008-06-04 05:40:35 nicm Exp $ */
+/* $Id: cmd-set-option.c,v 1.21 2008-06-04 05:47:46 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -180,12 +180,10 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
colour |= number << 4;
options_set_number(oo, "status-colour", colour);
- if (options_get_number(oo, "status-lines") > 0) {
- for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
- c = ARRAY_ITEM(&clients, i);
- if (c != NULL && c->session != NULL)
- server_redraw_client(c);
- }
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && c->session != NULL)
+ server_redraw_client(c);
}
} else if (strcmp(data->option, "status-bg") == 0) {
if (data->value == NULL) {
@@ -203,12 +201,10 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
colour |= number;
options_set_number(oo, "status-colour", colour);
- if (options_get_number(oo, "status-lines") > 0) {
- for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
- c = ARRAY_ITEM(&clients, i);
- if (c != NULL && c->session != NULL)
- server_redraw_client(c);
- }
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && c->session != NULL)
+ server_redraw_client(c);
}
} else if (strcmp(data->option, "bell-action") == 0) {
if (data->value == NULL) {
@@ -247,13 +243,27 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
ctx->error(ctx, "invalid value");
return;
}
+
options_set_string(oo, "status-left", "%s", data->value);
+
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && c->session != NULL)
+ server_redraw_client(c);
+ }
} else if (strcmp(data->option, "status-right") == 0) {
if (data->value == NULL) {
ctx->error(ctx, "invalid value");
return;
}
+
options_set_string(oo, "status-right", "%s", data->value);
+
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && c->session != NULL)
+ server_redraw_client(c);
+ }
} else {
ctx->error(ctx, "unknown option: %s", data->option);
return;