mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
parent
3ce0d0f877
commit
1c2661f1c3
@ -753,9 +753,11 @@ static struct cmd_t command_defs[] =
|
||||
"add account : Create a new account.",
|
||||
"rename account newname : Rename account to newname.",
|
||||
"set account property value : Set 'property' of 'account' to 'value'.",
|
||||
"clear account property value : Clear 'property' of 'account'.",
|
||||
"",
|
||||
"When connected, the /account command can be called with no arguments, to show current account settings.",
|
||||
"The 'property' may be one of.",
|
||||
"",
|
||||
"The set command may use one of the following for 'property'.",
|
||||
"jid : The Jabber ID of the account, the account name will be used if this property is not set.",
|
||||
"server : The chat server, if different to the domainpart of the JID.",
|
||||
"status : The presence status to use on login, use 'last' to use whatever your last status was.",
|
||||
@ -766,6 +768,9 @@ static struct cmd_t command_defs[] =
|
||||
"muc : The default MUC chat service to use.",
|
||||
"nick : The default nickname to use when joining chat rooms.",
|
||||
"",
|
||||
"The clear command may use one of the following for 'property'.",
|
||||
"password : Clears the password for the account.",
|
||||
"",
|
||||
"Example : /account add work",
|
||||
" : /account set work jid myuser@mycompany.com",
|
||||
" : /account set work server talk.google.com",
|
||||
@ -993,6 +998,7 @@ cmd_init(void)
|
||||
autocomplete_add(account_ac, "disable");
|
||||
autocomplete_add(account_ac, "rename");
|
||||
autocomplete_add(account_ac, "set");
|
||||
autocomplete_add(account_ac, "clear");
|
||||
|
||||
close_ac = autocomplete_new();
|
||||
autocomplete_add(close_ac, "read");
|
||||
@ -1579,6 +1585,27 @@ _cmd_account(gchar **args, struct cmd_help_t help)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (strcmp(command, "clear") == 0) {
|
||||
if (g_strv_length(args) != 3) {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
} else {
|
||||
char *account_name = args[1];
|
||||
char *property = args[2];
|
||||
|
||||
if (!accounts_account_exists(account_name)) {
|
||||
cons_show("Account %s doesn't exist", account_name);
|
||||
cons_show("");
|
||||
} else {
|
||||
if (strcmp(property, "password") == 0) {
|
||||
accounts_clear_password(account_name);
|
||||
cons_show("Removed password for account %s", account_name);
|
||||
cons_show("");
|
||||
} else {
|
||||
cons_show("Invalid property: %s", property);
|
||||
cons_show("");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cons_show("");
|
||||
}
|
||||
@ -3883,7 +3910,7 @@ _account_autocomplete(char *input, int *size)
|
||||
char *result = NULL;
|
||||
int i = 0;
|
||||
gchar *account_choice[] = { "/account set", "/account show", "/account enable",
|
||||
"/account disable", "/account rename" };
|
||||
"/account disable", "/account rename", "/account clear" };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(account_choice); i++) {
|
||||
result = autocomplete_param_with_func(input, size, account_choice[i],
|
||||
|
@ -443,6 +443,15 @@ accounts_set_password(const char * const account_name, const char * const value)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
accounts_clear_password(const char * const account_name)
|
||||
{
|
||||
if (accounts_account_exists(account_name)) {
|
||||
g_key_file_remove_key(accounts, account_name, "password", NULL);
|
||||
_save_accounts();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
accounts_set_muc_service(const char * const account_name, const char * const value)
|
||||
{
|
||||
|
@ -80,5 +80,6 @@ void accounts_set_priority_dnd(const char * const account_name, const gint value
|
||||
void accounts_set_priority_all(const char * const account_name, const gint value);
|
||||
gint accounts_get_priority_for_presence_type(const char * const account_name,
|
||||
resource_presence_t presence_type);
|
||||
void accounts_clear_password(const char * const account_name);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user