diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-08-27 12:05:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-08-27 12:05:15 +0000 |
commit | 6e210bb005ee5193fe030f5e8cfe8877aac6260d (patch) | |
tree | 8bbecf8301dd9334c925ee8cf9e9be188d81cd3c /session.c | |
parent | 7000277f949a11b6176d3f97cb1bf154c52b1009 (diff) |
If a session is destroyed, safely kill all other clients attached to it.
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.3 2007-08-27 09:53:38 nicm Exp $ */ +/* $Id: session.c,v 1.4 2007-08-27 12:05:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -119,7 +119,7 @@ session_attach(struct session *s, struct window *w) } /* Detach a window from a session. */ -int +void session_detach(struct session *s, struct window *w) { if (s->window == w) { @@ -128,13 +128,20 @@ session_detach(struct session *s, struct window *w) } window_remove(&s->windows, w); - if (ARRAY_EMPTY(&s->windows)) { - session_destroy(s); - return (1); - } return (0); } +/* Flush session if it is empty. */ +int +session_flush(struct session *s) +{ + if (!ARRAY_EMPTY(&s->windows)) + return (0); + + session_destroy(s); + return (1); +} + /* Return if session has window. */ int session_has(struct session *s, struct window *w) |