aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-19 22:20:04 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-19 22:20:04 +0000
commitacc331c787f4d85c0909563139f7cc81c54edc55 (patch)
treea60e276b1f7ffffe8f5dec00fac1c721ae4121d2 /server-client.c
parent8777a809dc06282c74fad56d2b76c9c2770c89d4 (diff)
downloadrtmux-acc331c787f4d85c0909563139f7cc81c54edc55.tar.gz
rtmux-acc331c787f4d85c0909563139f7cc81c54edc55.tar.bz2
rtmux-acc331c787f4d85c0909563139f7cc81c54edc55.zip
Sync OpenBSD patchset 546:
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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c
index 83b0f8ec..7605b775 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c,v 1.21 2009-11-14 17:51:06 tcunha Exp $ */
+/* $Id: server-client.c,v 1.22 2009-11-19 22:20:04 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -79,6 +79,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;
@@ -100,7 +101,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)
@@ -128,6 +130,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);