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