about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/command/command.c1
-rw-r--r--src/command/commands.c4
-rw-r--r--src/config/accounts.c10
-rw-r--r--src/config/accounts.h1
4 files changed, 16 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index d355eb04..9015fd2a 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -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");
diff --git a/src/command/commands.c b/src/command/commands.c
index 03759b4b..d8721834 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -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("");
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 0f7be510..cf7c4c93 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -390,6 +390,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)
 {
     if (accounts_account_exists(account_name)) {
@@ -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;
 }
 
diff --git a/src/config/accounts.h b/src/config/accounts.h
index de3c2a0f..60f8aa04 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -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