From 679e33d729d1c9ce3d3a2e7e5386524891f2e326 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 9 Apr 2012 21:01:51 -0700 Subject: [PATCH] NSM: Automatically start nsm-proxy if user attempts to add a client with arguments. --- session-manager/src/session-manager.C | 28 +++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/session-manager/src/session-manager.C b/session-manager/src/session-manager.C index 2f99e32..cc2976b 100644 --- a/session-manager/src/session-manager.C +++ b/session-manager/src/session-manager.C @@ -585,23 +585,41 @@ 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 */ @@ -609,6 +627,8 @@ public: { osc->send( (*d)->addr, "/nsm/server/add", name ); } + + free( name ); } }