mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
use enum
This commit is contained in:
parent
244a8c72b4
commit
085c08e65c
@ -88,11 +88,11 @@ static void sig_server_add_fill(IRC_SERVER_SETUP_REC *rec,
|
||||
if (value != NULL && *value != '\0') rec->max_query_chans = atoi(value);
|
||||
if (g_hash_table_lookup(optlist, "nodisallow_starttls") ||
|
||||
g_hash_table_lookup(optlist, "nostarttls"))
|
||||
rec->starttls = -1;
|
||||
rec->starttls = STARTTLS_NOTSET;
|
||||
if (g_hash_table_lookup(optlist, "disallow_starttls"))
|
||||
rec->starttls = 0;
|
||||
rec->starttls = STARTTLS_DISALLOW;
|
||||
if (g_hash_table_lookup(optlist, "starttls")) {
|
||||
rec->starttls = 1;
|
||||
rec->starttls = STARTTLS_ENABLED;
|
||||
rec->use_tls = 0;
|
||||
}
|
||||
}
|
||||
@ -118,9 +118,9 @@ static void cmd_server_list(const char *data)
|
||||
g_string_append(str, "autoconnect, ");
|
||||
if (rec->no_proxy)
|
||||
g_string_append(str, "noproxy, ");
|
||||
if (rec->starttls == 0)
|
||||
if (rec->starttls == STARTTLS_DISALLOW)
|
||||
g_string_append(str, "disallow_starttls, ");
|
||||
if (rec->starttls == 1)
|
||||
if (rec->starttls == STARTTLS_ENABLED)
|
||||
g_string_append(str, "starttls, ");
|
||||
if (rec->use_tls)
|
||||
g_string_append(str, "tls, ");
|
||||
|
@ -44,9 +44,9 @@ static void sig_server_setup_fill_reconn(IRC_SERVER_CONNECT_REC *conn,
|
||||
conn->max_cmds_at_once = sserver->max_cmds_at_once;
|
||||
if (sserver->max_query_chans > 0)
|
||||
conn->max_query_chans = sserver->max_query_chans;
|
||||
if (sserver->starttls == 0)
|
||||
if (sserver->starttls == STARTTLS_DISALLOW)
|
||||
conn->disallow_starttls = 1;
|
||||
else if (sserver->starttls == 1)
|
||||
else if (sserver->starttls == STARTTLS_ENABLED)
|
||||
conn->starttls = 1;
|
||||
}
|
||||
|
||||
@ -191,8 +191,8 @@ static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node)
|
||||
rec->max_cmds_at_once = config_node_get_int(node, "cmds_max_at_once", 0);
|
||||
rec->cmd_queue_speed = config_node_get_int(node, "cmd_queue_speed", 0);
|
||||
rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0);
|
||||
rec->starttls = config_node_get_bool(node, "starttls", -1);
|
||||
if (rec->starttls == 1) {
|
||||
rec->starttls = config_node_get_bool(node, "starttls", STARTTLS_NOTSET);
|
||||
if (rec->starttls == STARTTLS_ENABLED) {
|
||||
rec->use_tls = 0;
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,7 @@ static void sig_server_setup_saved(IRC_SERVER_SETUP_REC *rec,
|
||||
iconfig_node_set_int(node, "cmd_queue_speed", rec->cmd_queue_speed);
|
||||
if (rec->max_query_chans > 0)
|
||||
iconfig_node_set_int(node, "max_query_chans", rec->max_query_chans);
|
||||
if (rec->starttls >= 0)
|
||||
if (rec->starttls != STARTTLS_NOTSET)
|
||||
iconfig_node_set_bool(node, "starttls", rec->starttls);
|
||||
else
|
||||
iconfig_node_set_str(node, "starttls", NULL);
|
||||
|
@ -11,6 +11,12 @@
|
||||
#define IS_IRC_SERVER_SETUP(server) \
|
||||
(IRC_SERVER_SETUP(server) ? TRUE : FALSE)
|
||||
|
||||
enum {
|
||||
STARTTLS_DISALLOW = -1, /* */
|
||||
STARTTLS_NOTSET = 0,
|
||||
STARTTLS_ENABLED = 1
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
#include <irssi/src/core/server-setup-rec.h>
|
||||
|
||||
|
@ -303,7 +303,7 @@ static void init_ssl_loop(IRC_SERVER_REC *server, GIOChannel *handle)
|
||||
IRC_SERVER_SETUP_REC *ssetup = IRC_SERVER_SETUP(server_setup_find(
|
||||
server->connrec->address, server->connrec->port, server->connrec->chatnet));
|
||||
if (ssetup != NULL) {
|
||||
ssetup->starttls = 1;
|
||||
ssetup->starttls = STARTTLS_ENABLED;
|
||||
server_setup_add((SERVER_SETUP_REC *) ssetup);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <irssi/src/core/network.h>
|
||||
|
||||
#include <irssi/src/irc/core/irc-servers.h>
|
||||
#include <irssi/src/irc/core/irc-servers-setup.h>
|
||||
#include <irssi/src/irc/core/irc-channels.h>
|
||||
#include <irssi/src/irc/core/irc-nicklist.h>
|
||||
|
||||
@ -82,9 +83,9 @@ static void sig_session_save_server(IRC_SERVER_REC *server, CONFIG_REC *config,
|
||||
config_node_set_str(config, node, "sasl_password", server->connrec->sasl_password);
|
||||
|
||||
config_node_set_int(config, node, "starttls",
|
||||
server->connrec->disallow_starttls ? 0 :
|
||||
server->connrec->starttls ? 1 :
|
||||
-1);
|
||||
server->connrec->disallow_starttls ? STARTTLS_DISALLOW :
|
||||
server->connrec->starttls ? STARTTLS_ENABLED :
|
||||
STARTTLS_NOTSET);
|
||||
|
||||
config_node_set_bool(config, node, "isupport_sent", server->isupport_sent);
|
||||
isupport = config_node_section(config, node, "isupport", NODE_TYPE_BLOCK);
|
||||
@ -125,10 +126,10 @@ static void sig_session_restore_server(IRC_SERVER_REC *server,
|
||||
|
||||
server->connrec->channels = g_strdup(config_node_get_str(node, "rejoin_channels", NULL));
|
||||
|
||||
starttls_mode = config_node_get_int(node, "starttls", -1);
|
||||
if (starttls_mode == 0)
|
||||
starttls_mode = config_node_get_int(node, "starttls", STARTTLS_NOTSET);
|
||||
if (starttls_mode == STARTTLS_DISALLOW)
|
||||
server->connrec->disallow_starttls = 1;
|
||||
if (starttls_mode == 1) {
|
||||
if (starttls_mode == STARTTLS_ENABLED) {
|
||||
server->connrec->starttls = 1;
|
||||
server->connrec->use_tls = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user