Merge remote-tracking branch 'incertia/connect-default'

Conflicts:
	CHANGELOG
This commit is contained in:
James Booth
2014-12-29 15:29:28 +00:00
5 changed files with 81 additions and 8 deletions

View File

@@ -129,16 +129,18 @@ static struct cmd_t command_defs[] =
NULL } } },
{ "/connect",
cmd_connect, parse_args, 1, 5, NULL,
{ "/connect account [server value] [port value]", "Login to a chat service.",
{ "/connect account [server value] [port value]",
"--------------------------------------------",
cmd_connect, parse_args, 0, 5, NULL,
{ "/connect [account] [server value] [port value]", "Login to a chat service.",
{ "/connect [account] [server value] [port value]",
"----------------------------------------------",
"Connect to an XMPP service using the specified account.",
"Use the server property to specify a server if required.",
"Change the default port (5222, or 5223 for SSL) with the port property.",
"An account is automatically created if one does not exist.",
"If no account is specified, then the default account is used."
"See the /account command for more details.",
"",
"Example: /connect",
"Example: /connect myuser@gmail.com",
"Example: /connect myuser@mycompany.com server talk.google.com",
"Example: /connect bob@someplace port 5678",
@@ -911,6 +913,7 @@ static struct cmd_t command_defs[] =
"show account : Show information about an account.",
"enable account : Enable the account, it will be used for autocomplete.",
"disable account : Disable the account.",
"default [set|off] [account] : Set the default account.",
"add account : Create a new account.",
"remove account : Remove an account.",
"rename account newname : Rename account to newname.",
@@ -1076,6 +1079,7 @@ static Autocomplete theme_load_ac;
static Autocomplete account_ac;
static Autocomplete account_set_ac;
static Autocomplete account_clear_ac;
static Autocomplete account_default_ac;
static Autocomplete disco_ac;
static Autocomplete close_ac;
static Autocomplete wins_ac;
@@ -1239,6 +1243,7 @@ cmd_init(void)
autocomplete_add(account_ac, "remove");
autocomplete_add(account_ac, "enable");
autocomplete_add(account_ac, "disable");
autocomplete_add(account_ac, "default");
autocomplete_add(account_ac, "rename");
autocomplete_add(account_ac, "set");
autocomplete_add(account_ac, "clear");
@@ -1265,6 +1270,10 @@ cmd_init(void)
autocomplete_add(account_clear_ac, "port");
autocomplete_add(account_clear_ac, "otr");
account_default_ac = autocomplete_new();
autocomplete_add(account_default_ac, "set");
autocomplete_add(account_default_ac, "off");
close_ac = autocomplete_new();
autocomplete_add(close_ac, "read");
autocomplete_add(close_ac, "all");
@@ -1473,6 +1482,7 @@ cmd_uninit(void)
autocomplete_free(account_ac);
autocomplete_free(account_set_ac);
autocomplete_free(account_clear_ac);
autocomplete_free(account_default_ac);
autocomplete_free(disco_ac);
autocomplete_free(close_ac);
autocomplete_free(wins_ac);
@@ -1639,6 +1649,7 @@ cmd_reset_autocomplete()
autocomplete_reset(account_ac);
autocomplete_reset(account_set_ac);
autocomplete_reset(account_clear_ac);
autocomplete_reset(account_default_ac);
autocomplete_reset(disco_ac);
autocomplete_reset(close_ac);
autocomplete_reset(wins_ac);
@@ -2878,9 +2889,15 @@ _account_autocomplete(char *input, int *size)
g_strfreev(args);
found = autocomplete_param_with_ac(input, size, "/account default", account_default_ac, TRUE);
if(found){
return found;
}
int i = 0;
gchar *account_choice[] = { "/account set", "/account show", "/account enable",
"/account disable", "/account rename", "/account clear", "/account remove" };
"/account disable", "/account rename", "/account clear", "/account remove",
"/account default set" };
for (i = 0; i < ARRAY_SIZE(account_choice); i++) {
found = autocomplete_param_with_func(input, size, account_choice[i],