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

Merge pull request #315 from LemonBoy/prevent_blank_usermode

Don't set the usermode field if blank
This commit is contained in:
ailin-nemui 2015-10-02 11:48:11 +02:00
commit acbe2ecac2
2 changed files with 13 additions and 4 deletions

View File

@ -35,10 +35,13 @@ void ircnet_create(IRC_CHATNET_REC *rec)
static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node) static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
{ {
char *value;
if (!IS_IRC_CHATNET(rec)) if (!IS_IRC_CHATNET(rec))
return; 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->max_cmds_at_once = config_node_get_int(node, "cmdmax", 0);
rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0); rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0);

View File

@ -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) static void sig_server_setup_fill_connect(IRC_SERVER_CONNECT_REC *conn)
{ {
const char *value;
if (!IS_IRC_SERVER_CONNECT(conn)) if (!IS_IRC_SERVER_CONNECT(conn))
return; return;
conn->alternate_nick = *settings_get_str("alternate_nick") != '\0' ? value = settings_get_str("alternate_nick");
g_strdup(settings_get_str("alternate_nick")) : NULL; conn->alternate_nick = (value != NULL && *value != '\0') ?
conn->usermode = g_strdup(settings_get_str("usermode")); 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, static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,