diff options
author | LemonBoy <thatlemon@gmail.com> | 2015-10-02 11:25:30 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2015-10-02 11:25:30 +0200 |
commit | cfff402fe677316d286ce6663b8afeee4be95526 (patch) | |
tree | 43171e2d0014e2200226e24bd17919bf297a1cf6 /src/irc/core | |
parent | fb6375c6f9c1191590420482aea634644aa228eb (diff) | |
download | irssi-cfff402fe677316d286ce6663b8afeee4be95526.zip |
Don't set the usermode field if blank
Fixes FS#919
Diffstat (limited to 'src/irc/core')
-rw-r--r-- | src/irc/core/irc-chatnets.c | 5 | ||||
-rw-r--r-- | src/irc/core/irc-servers-setup.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/irc/core/irc-chatnets.c b/src/irc/core/irc-chatnets.c index d72f71dd..0796e0cb 100644 --- a/src/irc/core/irc-chatnets.c +++ b/src/irc/core/irc-chatnets.c @@ -35,10 +35,13 @@ void ircnet_create(IRC_CHATNET_REC *rec) static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node) { + char *value; + if (!IS_IRC_CHATNET(rec)) return; - rec->usermode = g_strdup(config_node_get_str(node, "usermode", NULL)); + value = config_node_get_str(node, "usermode", NULL); + rec->usermode = (value != NULL && *value != '\0') ? g_strdup(value) : NULL; rec->max_cmds_at_once = config_node_get_int(node, "cmdmax", 0); rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0); diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index bf1d2ddf..f425b587 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -48,12 +48,18 @@ static void sig_server_setup_fill_reconn(IRC_SERVER_CONNECT_REC *conn, static void sig_server_setup_fill_connect(IRC_SERVER_CONNECT_REC *conn) { + const char *value; + if (!IS_IRC_SERVER_CONNECT(conn)) return; - conn->alternate_nick = *settings_get_str("alternate_nick") != '\0' ? - g_strdup(settings_get_str("alternate_nick")) : NULL; - conn->usermode = g_strdup(settings_get_str("usermode")); + value = settings_get_str("alternate_nick"); + conn->alternate_nick = (value != NULL && *value != '\0') ? + g_strdup(value) : NULL; + + value = settings_get_str("usermode"); + conn->usermode = (value != NULL && *value != '\0') ? + g_strdup(value) : NULL; } static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn, |