NTK: Don't keep unneeded clients in session when switching.

This commit is contained in:
Jonathan Moore Liles 2013-05-05 10:30:08 -07:00
parent 8b5f5a76aa
commit f2bc2b5c9b
1 changed files with 6 additions and 8 deletions

View File

@ -1242,19 +1242,17 @@ load_session_file ( const char * path )
i != client.end(); i != client.end();
++i ) ++i )
{ {
if ( ! (*i)->is_capable_of( ":switch:" ) ) if ( ! (*i)->is_capable_of( ":switch:" ) || client_map.find((*i)->name ) == client_map.end() )
{ {
/* client is not capable of switch, or is not wanted in the new session */
command_client_to_quit( *i ); command_client_to_quit( *i );
} }
else else
{ {
if ( client_map.find((*i)->name ) != client_map.end() ) /* client is switch capable and may be wanted in the new session */
{ if ( client_map[ (*i)->name ]-- <= 0 )
/* client is switch capable and may be wanted in the new session */ /* nope,, we already have as many as we need, stop this one */
if ( client_map[ (*i)->name ]-- <= 0 ) command_client_to_quit( *i );
/* nope,, we already have as many as we need, stop this one */
command_client_to_quit( *i );
}
} }
} }