summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-18 13:16:33 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-18 13:16:33 +0000
commit8db145da1ed40d471e9ecff0e788ced26a43fc92 (patch)
treefdb41dfba63f5cb24ad9607c1e28abb58179f27c /server-client.c
parent68f5c9c72da0c4430733de2094fbb8bc4d1e0474 (diff)
Add a per-client log of status line messages displayed while that client
exists. A new message-limit session option sets the maximum number of entries and a command, show-messages, shows the log (bound to ~ by default). This (and prompt history) might be better as a single global log but until there are global options it is easier for them to be per client.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/server-client.c b/server-client.c
index a9058594..8ff71223 100644
--- a/server-client.c
+++ b/server-client.c
@@ -80,6 +80,7 @@ server_client_create(int fd)
job_tree_init(&c->status_jobs);
c->message_string = NULL;
+ ARRAY_INIT(&c->message_log);
c->prompt_string = NULL;
c->prompt_buffer = NULL;
@@ -101,7 +102,8 @@ server_client_create(int fd)
void
server_client_lost(struct client *c)
{
- u_int i;
+ struct message_entry *msg;
+ u_int i;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
if (ARRAY_ITEM(&clients, i) == c)
@@ -129,6 +131,11 @@ server_client_lost(struct client *c)
if (c->message_string != NULL)
xfree(c->message_string);
evtimer_del(&c->message_timer);
+ for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) {
+ msg = &ARRAY_ITEM(&c->message_log, i);
+ xfree(msg->msg);
+ }
+ ARRAY_FREE(&c->message_log);
if (c->prompt_string != NULL)
xfree(c->prompt_string);