1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Free account_name preference on autoconnect

This commit is contained in:
James Booth 2014-06-17 22:22:35 +01:00
parent fa0be4e50e
commit 4a485a64f9
2 changed files with 12 additions and 8 deletions

View File

@ -171,7 +171,7 @@ prefs_get_string(preference_t pref)
char *result = g_key_file_get_string(prefs, group, key, NULL);
if (result == NULL) {
return def;
return strdup(def);
} else {
return result;
}

View File

@ -72,14 +72,18 @@ prof_run(const int disable_tls, char *log_level, char *account_name)
ui_update_screen();
char *pref_connect_account = prefs_get_string(PREF_CONNECT_ACCOUNT);
if (account_name != NULL) {
char *cmd = "/connect";
snprintf(inp, sizeof(inp), "%s %s", cmd, account_name);
process_input(inp);
} else if (prefs_get_string(PREF_CONNECT_ACCOUNT) != NULL) {
char *cmd = "/connect";
snprintf(inp, sizeof(inp), "%s %s", cmd, prefs_get_string(PREF_CONNECT_ACCOUNT));
process_input(inp);
char *cmd = "/connect";
snprintf(inp, sizeof(inp), "%s %s", cmd, account_name);
process_input(inp);
} else if (pref_connect_account != NULL) {
char *cmd = "/connect";
snprintf(inp, sizeof(inp), "%s %s", cmd, pref_connect_account);
process_input(inp);
}
if (pref_connect_account != NULL) {
free(pref_connect_account);
}
while(cmd_result == TRUE) {