mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 20:46:21 +00:00
Allow "account" setting in [connection] to autconnect the account
closes #251
This commit is contained in:
@@ -94,6 +94,7 @@ static int _strtoi(char *str, int *saveptr, int min, int max);
|
||||
static gboolean _cmd_about(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_account(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_autoaway(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_autoconnect(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_autoping(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_away(gchar **args, struct cmd_help_t help);
|
||||
static gboolean _cmd_beep(gchar **args, struct cmd_help_t help);
|
||||
@@ -579,6 +580,16 @@ static struct cmd_t command_defs[] =
|
||||
"Switch on or off the ascii logo on start up and when the /about command is called.",
|
||||
NULL } } },
|
||||
|
||||
{ "/autoconnect",
|
||||
_cmd_autoconnect, parse_args, 0, 1, cons_autoconnect_setting,
|
||||
{ "/autoconnect [account]", "Set account to autoconnect with.",
|
||||
{ "/autoconnect [account]",
|
||||
"----------------------",
|
||||
"Set the account to autoconnect with.",
|
||||
"Will be overridden by any command line options specified.",
|
||||
"Passing no account will clear the setting.",
|
||||
NULL } } },
|
||||
|
||||
{ "/vercheck",
|
||||
_cmd_vercheck, parse_args, 0, 1, NULL,
|
||||
{ "/vercheck [on|off]", "Check for a new release.",
|
||||
@@ -1302,6 +1313,13 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
return;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_func(input, size, "/autoconnect", accounts_find_enabled);
|
||||
if (result != NULL) {
|
||||
inp_replace_input(input, result, size);
|
||||
g_free(result);
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac };
|
||||
|
||||
@@ -1809,7 +1827,7 @@ _cmd_help(gchar **args, struct cmd_help_t help)
|
||||
_cmd_show_filtered_help("Service discovery commands", filter, ARRAY_SIZE(filter));
|
||||
|
||||
} else if (strcmp(args[0], "settings") == 0) {
|
||||
gchar *filter[] = { "/account", "/autoaway", "/autoping", "/beep",
|
||||
gchar *filter[] = { "/account", "/autoaway", "/autoping", "/autoconnect", "/beep",
|
||||
"/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
||||
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
|
||||
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
|
||||
@@ -3447,6 +3465,19 @@ _cmd_splash(gchar **args, struct cmd_help_t help)
|
||||
"Splash screen", PREF_SPLASH);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_autoconnect(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
if (args[0] == NULL) {
|
||||
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
|
||||
cons_show("Autoconnect account disabled.");
|
||||
} else {
|
||||
prefs_set_string(PREF_CONNECT_ACCOUNT, args[0]);
|
||||
cons_show("Autoconnect account set to: %s.", args[0]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_chlog(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user