1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Added otr to /account clear properties

This commit is contained in:
James Booth 2014-05-11 15:32:38 +01:00
parent d44e954f6b
commit 3967b26aea
4 changed files with 16 additions and 0 deletions

View File

@ -1033,6 +1033,7 @@ cmd_init(void)
account_clear_ac = autocomplete_new();
autocomplete_add(account_clear_ac, "password");
autocomplete_add(account_clear_ac, "otr");
close_ac = autocomplete_new();
autocomplete_add(close_ac, "read");

View File

@ -341,6 +341,10 @@ cmd_account(gchar **args, struct cmd_help_t help)
accounts_clear_password(account_name);
cons_show("Removed password 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);
cons_show("");
} else {
cons_show("Invalid property: %s", property);
cons_show("");

View File

@ -389,6 +389,15 @@ _accounts_clear_password(const char * const account_name)
}
}
static void
_accounts_clear_otr(const char * const account_name)
{
if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "otr.policy", NULL);
_save_accounts();
}
}
static void
_accounts_set_muc_service(const char * const account_name, const char * const value)
{
@ -689,5 +698,6 @@ accounts_init_module(void)
accounts_set_priority_all = _accounts_set_priority_all;
accounts_get_priority_for_presence_type = _accounts_get_priority_for_presence_type;
accounts_clear_password = _accounts_clear_password;
accounts_clear_otr = _accounts_clear_otr;
}

View File

@ -66,5 +66,6 @@ void (*accounts_set_priority_all)(const char * const account_name, const gint va
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_otr)(const char * const account_name);
#endif