diff options
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/accounts.c | 12 | ||||
-rw-r--r-- | src/config/accounts.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/config/accounts.c b/src/config/accounts.c index 4eb4b8e3..3150686b 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -39,10 +39,12 @@ static GKeyFile *accounts; static Autocomplete all_ac; static Autocomplete enabled_ac; +// used to rename account (copies properties to new account) static gchar *string_keys[] = { "jid", "server", "resource", + "password", "presence.last", "presence.login", "muc.service", @@ -191,6 +193,14 @@ accounts_get_account(const char * const name) _save_accounts(); } + gchar *password = g_key_file_get_string(accounts, name, "password", NULL); + if (password != NULL) { + account->password = strdup(password); + g_free(password); + } else { + account->password = NULL; + } + account->enabled = g_key_file_get_boolean(accounts, name, "enabled", NULL); gchar *server = g_key_file_get_string(accounts, name, "server", NULL); @@ -288,6 +298,7 @@ accounts_free_account(ProfAccount *account) if (account != NULL) { free(account->name); free(account->jid); + free(account->password); free(account->resource); free(account->server); free(account->last_presence); @@ -349,6 +360,7 @@ accounts_rename(const char * const account_name, const char * const new_name) g_key_file_set_integer(accounts, new_name, "priority.dnd", g_key_file_get_boolean(accounts, account_name, "priority.dnd", NULL)); + // copy other string properties int i; for (i = 0; i < ARRAY_SIZE(string_keys); i++) { char *value = g_key_file_get_string(accounts, account_name, string_keys[i], NULL); diff --git a/src/config/accounts.h b/src/config/accounts.h index 4c74a523..ba282eac 100644 --- a/src/config/accounts.h +++ b/src/config/accounts.h @@ -28,6 +28,7 @@ typedef struct prof_account_t { gchar *name; gchar *jid; + gchar *password; gchar *resource; gchar *server; gchar *last_presence; |