mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge branch 'master' into priority
This commit is contained in:
commit
4886577302
@ -39,6 +39,8 @@ static GKeyFile *accounts;
|
||||
static Autocomplete all_ac;
|
||||
static Autocomplete enabled_ac;
|
||||
|
||||
static gchar *string_keys[] = {"jid", "server", "resource", "presence.last", "presence.login"};
|
||||
|
||||
static void _fix_legacy_accounts(const char * const account_name);
|
||||
static void _save_accounts(void);
|
||||
|
||||
@ -129,6 +131,8 @@ accounts_add(const char *account_name, const char *altdomain)
|
||||
if (altdomain != NULL) {
|
||||
g_key_file_set_string(accounts, account_name, "server", altdomain);
|
||||
}
|
||||
g_key_file_set_string(accounts, account_name, "presence.last", "online");
|
||||
g_key_file_set_string(accounts, account_name, "presence.login", "online");
|
||||
|
||||
_save_accounts();
|
||||
autocomplete_add(all_ac, strdup(account_name));
|
||||
@ -254,22 +258,13 @@ accounts_rename(const char * const account_name, const char * const new_name)
|
||||
g_key_file_set_boolean(accounts, new_name, "enabled",
|
||||
g_key_file_get_boolean(accounts, account_name, "enabled", NULL));
|
||||
|
||||
char *jid = g_key_file_get_string(accounts, account_name, "jid", NULL);
|
||||
if (jid != NULL) {
|
||||
g_key_file_set_string(accounts, new_name, "jid", jid);
|
||||
free(jid);
|
||||
}
|
||||
|
||||
char *server = g_key_file_get_string(accounts, account_name, "server", NULL);
|
||||
if (server != NULL) {
|
||||
g_key_file_set_string(accounts, new_name, "server", server);
|
||||
free(server);
|
||||
}
|
||||
|
||||
char *resource = g_key_file_get_string(accounts, account_name, "resource", NULL);
|
||||
if (resource != NULL) {
|
||||
g_key_file_set_string(accounts, new_name, "resource", resource);
|
||||
free(resource);
|
||||
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);
|
||||
if (value != NULL) {
|
||||
g_key_file_set_string(accounts, new_name, string_keys[i], value);
|
||||
free(value);
|
||||
}
|
||||
}
|
||||
|
||||
g_key_file_remove_group(accounts, account_name, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user