Code ended up in wrong place during refactoring

This commit is contained in:
Jari Matilainen 2016-01-28 15:05:28 +01:00
commit a86f7ef7d7
3 changed files with 8 additions and 18 deletions

View file

@ -250,8 +250,6 @@ static CHANNEL_SETUP_REC *channel_setup_fill_rec(CHANNEL_SETUP_REC *rec, GHashTa
{ {
char *botarg, *botcmdarg; char *botarg, *botcmdarg;
g_return_if_fail(rec != NULL);
botarg = g_hash_table_lookup(optlist, "bots"); botarg = g_hash_table_lookup(optlist, "bots");
botcmdarg = g_hash_table_lookup(optlist, "botcmd"); botcmdarg = g_hash_table_lookup(optlist, "botcmd");
@ -302,7 +300,6 @@ static void cmd_channel_add(const char *data)
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
rec = channel_setup_fill_rec(rec, optlist); rec = channel_setup_fill_rec(rec, optlist);
channel_setup_create(rec); channel_setup_create(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_CHANSETUP_ADDED, channel, chatnet); TXT_CHANSETUP_ADDED, channel, chatnet);
@ -336,16 +333,15 @@ static void cmd_channel_modify(const char *data)
} }
rec = channel_setup_find(channel, chatnet); rec = channel_setup_find(channel, chatnet);
if (rec == NULL) { if (rec == NULL)
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_NOT_FOUND, channel, chatnet); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_CHANSETUP_NOT_FOUND, channel, chatnet);
} else { else {
if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks); if (g_hash_table_lookup(optlist, "bots")) g_free_and_null(rec->botmasks);
if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd); if (g_hash_table_lookup(optlist, "botcmd")) g_free_and_null(rec->autosendcmd);
if (*password != '\0') g_free_and_null(rec->password); if (*password != '\0') g_free_and_null(rec->password);
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
rec = channel_setup_fill_rec(rec, optlist); rec = channel_setup_fill_rec(rec, optlist);
channel_setup_create(rec); channel_setup_create(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_CHANSETUP_MODIFIED, channel, chatnet); TXT_CHANSETUP_MODIFIED, channel, chatnet);

View file

@ -107,7 +107,6 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist)
static SERVER_SETUP_REC *server_setup_fill_rec(SERVER_SETUP_REC *rec, GHashTable *optlist) static SERVER_SETUP_REC *server_setup_fill_rec(SERVER_SETUP_REC *rec, GHashTable *optlist)
{ {
g_return_if_fail(rec != NULL);
char *value; char *value;
if (g_hash_table_lookup(optlist, "6")) if (g_hash_table_lookup(optlist, "6"))
@ -207,9 +206,7 @@ static void cmd_server_add(const char *data)
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
rec = server_setup_fill_rec(rec, optlist); rec = server_setup_fill_rec(rec, optlist);
signal_emit("server add fill", 2, rec, optlist); signal_emit("server add fill", 2, rec, optlist);
server_setup_add(rec); server_setup_add(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_SETUPSERVER_ADDED, addr, port); TXT_SETUPSERVER_ADDED, addr, port);
@ -251,9 +248,7 @@ static void cmd_server_modify(const char *data)
if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password); if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
rec = server_setup_fill_rec(rec, optlist); rec = server_setup_fill_rec(rec, optlist);
signal_emit("server modify fill", 2, rec, optlist); signal_emit("server modify fill", 2, rec, optlist);
server_setup_add(rec); server_setup_add(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_SETUPSERVER_MODIFIED, addr, port); TXT_SETUPSERVER_MODIFIED, addr, port);

View file

@ -92,8 +92,6 @@ static IRC_CHATNET_REC *network_setup_fill_rec(IRC_CHATNET_REC *rec, GHashTable
{ {
char *value; char *value;
g_return_if_fail(rec != NULL);
value = g_hash_table_lookup(optlist, "kicks"); value = g_hash_table_lookup(optlist, "kicks");
if (value != NULL) rec->max_kicks = atoi(value); if (value != NULL) rec->max_kicks = atoi(value);
value = g_hash_table_lookup(optlist, "msgs"); value = g_hash_table_lookup(optlist, "msgs");
@ -170,12 +168,13 @@ static void cmd_network_add(const char *data)
g_free_and_null(rec->own_host); g_free_and_null(rec->own_host);
rec->own_ip4 = rec->own_ip6 = NULL; 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, "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, "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_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_username")) g_free_and_null(rec->sasl_username);
if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password); if (g_hash_table_lookup(optlist, "sasl_password")) g_free_and_null(rec->sasl_password);
}
rec = network_setup_fill_rec(rec, optlist); rec = network_setup_fill_rec(rec, optlist);