Skip to content

Commit

Permalink
Treat --connect as --command connect in case GUI is already running
Browse files Browse the repository at this point in the history
- This makes the behaviour more intuitive for those used to the
  auto connect option (--connect xxx). Note: this will work only for
  the first occurrence of --connect as --command allows only one profile
  to be speciifed.
- Also make '--command connect' behave as '--connect' if the GUI is not
  already running.

Based on comment by larson0815 here:
selvanair#5

Signed-off-by: Selva Nair <[email protected]>
  • Loading branch information
selvanair committed Jan 20, 2018
1 parent 0f21030 commit eb52950
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ add_option(options_t *options, int i, TCHAR **p)
exit(1);
}
options->auto_connect[auto_connect_nr++] = p[1];
/* Treat the first connect option to also mean --command connect profile.
* This gets used if we are not the first instance.
*/
if (auto_connect_nr == 1)
{
options->action = WM_OVPN_START;
options->action_arg = p[1];
}
}
else if (streq(p[0], _T("exe_path")) && p[1])
{
Expand Down Expand Up @@ -209,6 +217,8 @@ add_option(options_t *options, int i, TCHAR **p)
/* command to be sent to a running instance */
if (streq(p[1], _T("connect")) && p[2])
{
/* Treat this as "--connect profile" in case this is the first instance */
add_option(options, i, &p[1]);
++i;
options->action = WM_OVPN_START;
options->action_arg = p[2];
Expand Down

0 comments on commit eb52950

Please sign in to comment.