1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added /account clear [account] port

This commit is contained in:
James Booth 2014-10-23 23:12:15 +01:00
parent 552d88b931
commit 84765969e0
4 changed files with 16 additions and 0 deletions

View File

@ -1195,6 +1195,7 @@ cmd_init(void)
account_clear_ac = autocomplete_new();
autocomplete_add(account_clear_ac, "password");
autocomplete_add(account_clear_ac, "server");
autocomplete_add(account_clear_ac, "port");
autocomplete_add(account_clear_ac, "otr");
close_ac = autocomplete_new();

View File

@ -366,6 +366,10 @@ cmd_account(gchar **args, struct cmd_help_t help)
accounts_clear_server(account_name);
cons_show("Removed server for account %s", account_name);
cons_show("");
} else if (strcmp(property, "port") == 0) {
accounts_clear_port(account_name);
cons_show("Removed port for account %s", account_name);
cons_show("");
} else if (strcmp(property, "otr") == 0) {
accounts_clear_otr(account_name);
cons_show("OTR policy removed for account %s", account_name);

View File

@ -449,6 +449,15 @@ _accounts_clear_server(const char * const account_name)
}
}
static void
_accounts_clear_port(const char * const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "port", NULL);
_save_accounts();
}
}
static void
_accounts_clear_otr(const char * const account_name)
{
@ -872,6 +881,7 @@ accounts_init_module(void)
accounts_get_priority_for_presence_type = _accounts_get_priority_for_presence_type;
accounts_clear_password = _accounts_clear_password;
accounts_clear_server = _accounts_clear_server;
accounts_clear_port = _accounts_clear_port;
accounts_clear_otr = _accounts_clear_otr;
accounts_add_otr_policy = _accounts_add_otr_policy;
}

View File

@ -79,6 +79,7 @@ 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);
void (*accounts_clear_server)(const char * const account_name);
void (*accounts_clear_port)(const char * const account_name);
void (*accounts_clear_otr)(const char * const account_name);
void (*accounts_add_otr_policy)(const char * const account_name, const char * const contact_jid, const char * const policy);