Make server exit when last session dies. Also fix window check for status activity redraw.

This commit is contained in:
Nicholas Marriott
2008-06-06 17:55:27 +00:00
parent 6a187bb8d3
commit 3cd4a08ffb
5 changed files with 50 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $Id: session.c,v 1.35 2008-06-06 17:20:29 nicm Exp $ */
/* $Id: session.c,v 1.36 2008-06-06 17:55:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -55,7 +55,8 @@ session_alert_add(struct session *s, struct window *w, int type)
if (wl == s->curw)
continue;
if (wl->window == w && !session_alert_has(s, wl, type)) {
if (wl->window == w &&
!session_alert_has(s, wl, type)) {
sa = xmalloc(sizeof *sa);
sa->wl = wl;
sa->type = type;
@ -77,6 +78,19 @@ session_alert_has(struct session *s, struct winlink *wl, int type)
return (0);
}
int
session_alert_has_window(struct session *s, struct window *w, int type)
{
struct session_alert *sa;
TAILQ_FOREACH(sa, &s->alerts, entry) {
if (sa->wl->window == w && sa->type == type)
return (1);
}
return (0);
}
/* Find session by name. */
struct session *
session_find(const char *name)