mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-25 16:19:02 +01:00
Sync OpenBSD patchset 556:
Remove oldest messages from log when limit is hit, not newest.
This commit is contained in:
parent
074780fea4
commit
1d58ca61a7
13
status.c
13
status.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: status.c,v 1.134 2009-11-22 00:09:42 tcunha Exp $ */
|
/* $Id: status.c,v 1.135 2009-11-22 00:10:39 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -650,10 +650,13 @@ status_message_set(struct client *c, const char *fmt, ...)
|
|||||||
limit = 0;
|
limit = 0;
|
||||||
else
|
else
|
||||||
limit = options_get_number(&s->options, "message-limit");
|
limit = options_get_number(&s->options, "message-limit");
|
||||||
for (i = ARRAY_LENGTH(&c->message_log); i > limit; i--) {
|
if (ARRAY_LENGTH(&c->message_log) > limit) {
|
||||||
msg = &ARRAY_ITEM(&c->message_log, i - 1);
|
limit = ARRAY_LENGTH(&c->message_log) - limit;
|
||||||
xfree(msg->msg);
|
for (i = 0; i < limit; i++) {
|
||||||
ARRAY_REMOVE(&c->message_log, i - 1);
|
msg = &ARRAY_FIRST(&c->message_log);
|
||||||
|
xfree(msg->msg);
|
||||||
|
ARRAY_REMOVE(&c->message_log, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = options_get_number(&c->session->options, "display-time");
|
delay = options_get_number(&c->session->options, "display-time");
|
||||||
|
Loading…
Reference in New Issue
Block a user