mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 21:26:21 +00:00
Merge remote-tracking branch 'tsenart/passwords-on-accounts-file'
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
typedef struct prof_account_t {
|
||||
gchar *name;
|
||||
gchar *jid;
|
||||
gchar *password;
|
||||
gchar *resource;
|
||||
gchar *server;
|
||||
gchar *last_presence;
|
||||
|
||||
Reference in New Issue
Block a user