about summary refs log tree commit diff stats
path: root/src/config/accounts.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-09-28 20:42:59 +0100
committerJames Booth <boothj5@gmail.com>2015-09-28 20:42:59 +0100
commit16103f6cc70222fbf5434c0f29a8bd0487d69e78 (patch)
tree50b9484afb2b6884d7941a5ee6285f51eeba03d0 /src/config/accounts.c
parent12ae21ccb6d502dc8a4552d12286e9e746b79c10 (diff)
downloadprofani-tty-16103f6cc70222fbf5434c0f29a8bd0487d69e78.tar.gz
Removed old code to fix legacy accounts
Diffstat (limited to 'src/config/accounts.c')
-rw-r--r--src/config/accounts.c60
1 files changed, 2 insertions, 58 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c
index 0abfc0d4..06506e23 100644
--- a/src/config/accounts.c
+++ b/src/config/accounts.c
@@ -68,12 +68,10 @@ static gchar *string_keys[] = {
     "otr.policy"
 };
 
-static void _fix_legacy_accounts(const char * const account_name);
 static void _save_accounts(void);
 static gchar * _get_accounts_file(void);
 static void _remove_from_list(GKeyFile *accounts, const char * const account_name, const char * const key, const char * const contact_jid);
 
-
 void
 accounts_load(void)
 {
@@ -87,13 +85,11 @@ accounts_load(void)
     }
 
     accounts = g_key_file_new();
-    g_key_file_load_from_file(accounts, accounts_loc, G_KEY_FILE_KEEP_COMMENTS,
-        NULL);
+    g_key_file_load_from_file(accounts, accounts_loc, G_KEY_FILE_KEEP_COMMENTS, NULL);
 
     // create the logins searchable list for autocompletion
     gsize naccounts;
-    gchar **account_names =
-        g_key_file_get_groups(accounts, &naccounts);
+    gchar **account_names = g_key_file_get_groups(accounts, &naccounts);
 
     gsize i;
     for (i = 0; i < naccounts; i++) {
@@ -101,8 +97,6 @@ accounts_load(void)
         if (g_key_file_get_boolean(accounts, account_names[i], "enabled", NULL)) {
             autocomplete_add(enabled_ac, account_names[i]);
         }
-
-        _fix_legacy_accounts(account_names[i]);
     }
 
     g_strfreev(account_names);
@@ -876,56 +870,6 @@ accounts_get_login_presence(const char * const account_name)
 }
 
 static void
-_fix_legacy_accounts(const char * const account_name)
-{
-    // set barejid and resource
-    const char *barejid = account_name;
-    const char *resource = "profanity";
-    Jid *jid = jid_create(account_name);
-    if (jid) {
-        barejid = jid->barejid;
-        if (jid->resourcepart) {
-            resource = jid->resourcepart;
-        }
-    }
-
-    // accounts with no jid property
-    if (!g_key_file_has_key(accounts, account_name, "jid", NULL)) {
-        g_key_file_set_string(accounts, account_name, "jid", barejid);
-        _save_accounts();
-    }
-
-    // accounts with no resource, property
-    if (!g_key_file_has_key(accounts, account_name, "resource", NULL)) {
-        g_key_file_set_string(accounts, account_name, "resource", resource);
-        _save_accounts();
-    }
-
-    // accounts with no muc service or nick
-    if (!g_key_file_has_key(accounts, account_name, "muc.service", NULL)) {
-        gchar *account_jid = g_key_file_get_string(accounts, account_name, "jid", NULL);
-        Jid *jidp = jid_create(account_jid);
-        GString *muc_service = g_string_new("conference.");
-        g_string_append(muc_service, jidp->domainpart);
-        g_key_file_set_string(accounts, account_name, "muc.service", muc_service->str);
-        g_string_free(muc_service, TRUE);
-        jid_destroy(jidp);
-    }
-    if (!g_key_file_has_key(accounts, account_name, "muc.nick", NULL)) {
-        gchar *account_jid = g_key_file_get_string(accounts, account_name, "jid", NULL);
-        Jid *jidp = jid_create(account_jid);
-        if (jidp->localpart == NULL) {
-            g_key_file_set_string(accounts, account_name, "muc.nick", jidp->domainpart);
-        } else {
-            g_key_file_set_string(accounts, account_name, "muc.nick", jidp->localpart);
-        }
-        jid_destroy(jidp);
-    }
-
-    jid_destroy(jid);
-}
-
-static void
 _save_accounts(void)
 {
     gsize g_data_size;