about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-11-22 00:39:52 +0000
committerJames Booth <boothj5@gmail.com>2016-11-22 00:39:52 +0000
commite043029a5069a30e8a7154a07d46260bece6358c (patch)
tree8e5affaa094513ae5d9c8c0c082f20f57e83629c /src/config
parentc441dbfa42e58796f87fdcbb02ee4aa19cca2469 (diff)
downloadprofani-tty-e043029a5069a30e8a7154a07d46260bece6358c.tar.gz
Allow clearing account resource
issue #880
Diffstat (limited to 'src/config')
-rw-r--r--src/config/account.c2
-rw-r--r--src/config/account.h2
-rw-r--r--src/config/accounts.c9
-rw-r--r--src/config/accounts.h1
4 files changed, 12 insertions, 2 deletions
diff --git a/src/config/account.c b/src/config/account.c
index 40b91224..8baa1dbb 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -167,7 +167,7 @@ account_new(const gchar *const name, const gchar *const jid,
 }
 
 char*
-account_create_full_jid(ProfAccount *account)
+account_create_connect_jid(ProfAccount *account)
 {
     if (account->resource) {
         return create_fulljid(account->jid, account->resource);
diff --git a/src/config/account.h b/src/config/account.h
index 09166752..32fee0f8 100644
--- a/src/config/account.h
+++ b/src/config/account.h
@@ -74,7 +74,7 @@ ProfAccount* account_new(const gchar *const name, const gchar *const jid,
     const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
     GList *otr_always, const gchar *const pgp_keyid, const char *const startscript,
     const char *const theme, gchar *tls_policy);
-char* account_create_full_jid(ProfAccount *account);
+char* account_create_connect_jid(ProfAccount *account);
 gboolean account_eval_password(ProfAccount *account);
 void account_free(ProfAccount *account);
 
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 233a5aa8..7dc852ae 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -585,6 +585,15 @@ accounts_clear_muc(const char *const account_name)
 }
 
 void
+accounts_clear_resource(const char *const account_name)
+{
+    if (accounts_account_exists(account_name)) {
+        g_key_file_remove_key(accounts, account_name, "resource", NULL);
+        _save_accounts();
+    }
+}
+
+void
 accounts_clear_otr(const char *const account_name)
 {
     if (accounts_account_exists(account_name)) {
diff --git a/src/config/accounts.h b/src/config/accounts.h
index 6c6cb1c9..4d30cbd9 100644
--- a/src/config/accounts.h
+++ b/src/config/accounts.h
@@ -94,6 +94,7 @@ void accounts_clear_pgp_keyid(const char *const account_name);
 void accounts_clear_script_start(const char *const account_name);
 void accounts_clear_theme(const char *const account_name);
 void accounts_clear_muc(const char *const account_name);
+void accounts_clear_resource(const char *const account_name);
 void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy);
 
 #endif