refactoring

This commit is contained in:
Jari Matilainen 2016-03-24 16:06:14 +01:00
commit 252829a9ad

View file

@ -121,6 +121,12 @@ static IRC_CHATNET_REC *network_setup_fill_rec(IRC_CHATNET_REC *rec, GHashTable
rec->own_ip4 = rec->own_ip6 = NULL;
}
if (g_hash_table_lookup(optlist, "usermode")) g_free_and_null(rec->usermode);
if (g_hash_table_lookup(optlist, "autosendcmd")) g_free_and_null(rec->autosendcmd);
if (g_hash_table_lookup(optlist, "sasl_mechanism")) g_free_and_null(rec->sasl_mechanism);
if (g_hash_table_lookup(optlist, "sasl_username")) g_free_and_null(rec->sasl_username);
if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password);
value = g_hash_table_lookup(optlist, "usermode");
if (value != NULL && *value != '\0') rec->usermode = g_strdup(value);
value = g_hash_table_lookup(optlist, "autosendcmd");
@ -170,12 +176,6 @@ static void cmd_network_add(const char *data)
}
}
if (g_hash_table_lookup(optlist, "usermode")) g_free_and_null(rec->usermode);
if (g_hash_table_lookup(optlist, "autosendcmd")) g_free_and_null(rec->autosendcmd);
if (g_hash_table_lookup(optlist, "sasl_mechanism")) g_free_and_null(rec->sasl_mechanism);
if (g_hash_table_lookup(optlist, "sasl_username")) g_free_and_null(rec->sasl_username);
if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password);
rec = network_setup_fill_rec(rec, optlist);
ircnet_create(rec);
@ -214,11 +214,6 @@ static void cmd_network_modify(const char *data)
g_free_and_null(rec->own_host);
rec->own_ip4 = rec->own_ip6 = NULL;
}
if (g_hash_table_lookup(optlist, "usermode")) g_free_and_null(rec->usermode);
if (g_hash_table_lookup(optlist, "autosendcmd")) g_free_and_null(rec->autosendcmd);
if (g_hash_table_lookup(optlist, "sasl_mechanism")) g_free_and_null(rec->sasl_mechanism);
if (g_hash_table_lookup(optlist, "sasl_username")) g_free_and_null(rec->sasl_username);
if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password);
rec = network_setup_fill_rec(rec, optlist);