NSM: Automatically start nsm-proxy if user attempts to add a client with arguments.

This commit is contained in:
Jonathan Moore Liles 2012-04-09 21:01:51 -07:00
parent 11a0d40e86
commit 679e33d729
1 changed files with 24 additions and 4 deletions

View File

@ -585,30 +585,50 @@ public:
if ( ! browser->value() )
return;
const char *name = fl_input( "Add Client" );
const char *n = fl_input( "Add Client" );
if ( !name )
if ( !n )
return;
char *name = strdup( n );
if ( index( name, ' ' ) )
{
free( name );
name = strdup( "nsm-proxy" );
}
lo_address nsm_addr = lo_address_new_from_url( browser->text( browser->value() ) );
osc->send( nsm_addr, "/nsm/server/add", name );
free( name );
delete win;
}
else
{
const char *name = fl_input( "Add Client" );
const char *n = fl_input( "Add Client" );
if ( !name )
if ( !n )
return;
char *name = strdup( n );
if ( index( name, ' ' ) )
{
free( name );
name = strdup( "nsm-proxy" );
}
MESSAGE( "Sending add for: %s", name );
/* FIXME: user should get to choose which system to do the add on */
foreach_daemon ( d )
{
osc->send( (*d)->addr, "/nsm/server/add", name );
}
free( name );
}
}