1
0
mirror of https://github.com/irssi/irssi.git synced 2025-02-02 15:08:01 -05:00
This commit is contained in:
Ailin Nemui 2021-04-07 22:29:48 +02:00
parent 244a8c72b4
commit 085c08e65c
5 changed files with 24 additions and 17 deletions

View File

@ -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 (value != NULL && *value != '\0') rec->max_query_chans = atoi(value);
if (g_hash_table_lookup(optlist, "nodisallow_starttls") || if (g_hash_table_lookup(optlist, "nodisallow_starttls") ||
g_hash_table_lookup(optlist, "nostarttls")) g_hash_table_lookup(optlist, "nostarttls"))
rec->starttls = -1; rec->starttls = STARTTLS_NOTSET;
if (g_hash_table_lookup(optlist, "disallow_starttls")) if (g_hash_table_lookup(optlist, "disallow_starttls"))
rec->starttls = 0; rec->starttls = STARTTLS_DISALLOW;
if (g_hash_table_lookup(optlist, "starttls")) { if (g_hash_table_lookup(optlist, "starttls")) {
rec->starttls = 1; rec->starttls = STARTTLS_ENABLED;
rec->use_tls = 0; rec->use_tls = 0;
} }
} }
@ -118,9 +118,9 @@ static void cmd_server_list(const char *data)
g_string_append(str, "autoconnect, "); g_string_append(str, "autoconnect, ");
if (rec->no_proxy) if (rec->no_proxy)
g_string_append(str, "noproxy, "); g_string_append(str, "noproxy, ");
if (rec->starttls == 0) if (rec->starttls == STARTTLS_DISALLOW)
g_string_append(str, "disallow_starttls, "); g_string_append(str, "disallow_starttls, ");
if (rec->starttls == 1) if (rec->starttls == STARTTLS_ENABLED)
g_string_append(str, "starttls, "); g_string_append(str, "starttls, ");
if (rec->use_tls) if (rec->use_tls)
g_string_append(str, "tls, "); g_string_append(str, "tls, ");

View File

@ -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; conn->max_cmds_at_once = sserver->max_cmds_at_once;
if (sserver->max_query_chans > 0) if (sserver->max_query_chans > 0)
conn->max_query_chans = sserver->max_query_chans; conn->max_query_chans = sserver->max_query_chans;
if (sserver->starttls == 0) if (sserver->starttls == STARTTLS_DISALLOW)
conn->disallow_starttls = 1; conn->disallow_starttls = 1;
else if (sserver->starttls == 1) else if (sserver->starttls == STARTTLS_ENABLED)
conn->starttls = 1; 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->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->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->max_query_chans = config_node_get_int(node, "max_query_chans", 0);
rec->starttls = config_node_get_bool(node, "starttls", -1); rec->starttls = config_node_get_bool(node, "starttls", STARTTLS_NOTSET);
if (rec->starttls == 1) { if (rec->starttls == STARTTLS_ENABLED) {
rec->use_tls = 0; 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); iconfig_node_set_int(node, "cmd_queue_speed", rec->cmd_queue_speed);
if (rec->max_query_chans > 0) if (rec->max_query_chans > 0)
iconfig_node_set_int(node, "max_query_chans", rec->max_query_chans); 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); iconfig_node_set_bool(node, "starttls", rec->starttls);
else else
iconfig_node_set_str(node, "starttls", NULL); iconfig_node_set_str(node, "starttls", NULL);

View File

@ -11,6 +11,12 @@
#define IS_IRC_SERVER_SETUP(server) \ #define IS_IRC_SERVER_SETUP(server) \
(IRC_SERVER_SETUP(server) ? TRUE : FALSE) (IRC_SERVER_SETUP(server) ? TRUE : FALSE)
enum {
STARTTLS_DISALLOW = -1, /* */
STARTTLS_NOTSET = 0,
STARTTLS_ENABLED = 1
};
typedef struct { typedef struct {
#include <irssi/src/core/server-setup-rec.h> #include <irssi/src/core/server-setup-rec.h>

View File

@ -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( IRC_SERVER_SETUP_REC *ssetup = IRC_SERVER_SETUP(server_setup_find(
server->connrec->address, server->connrec->port, server->connrec->chatnet)); server->connrec->address, server->connrec->port, server->connrec->chatnet));
if (ssetup != NULL) { if (ssetup != NULL) {
ssetup->starttls = 1; ssetup->starttls = STARTTLS_ENABLED;
server_setup_add((SERVER_SETUP_REC *) ssetup); server_setup_add((SERVER_SETUP_REC *) ssetup);
} }
} }

View File

@ -26,6 +26,7 @@
#include <irssi/src/core/network.h> #include <irssi/src/core/network.h>
#include <irssi/src/irc/core/irc-servers.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-channels.h>
#include <irssi/src/irc/core/irc-nicklist.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_str(config, node, "sasl_password", server->connrec->sasl_password);
config_node_set_int(config, node, "starttls", config_node_set_int(config, node, "starttls",
server->connrec->disallow_starttls ? 0 : server->connrec->disallow_starttls ? STARTTLS_DISALLOW :
server->connrec->starttls ? 1 : server->connrec->starttls ? STARTTLS_ENABLED :
-1); STARTTLS_NOTSET);
config_node_set_bool(config, node, "isupport_sent", server->isupport_sent); config_node_set_bool(config, node, "isupport_sent", server->isupport_sent);
isupport = config_node_section(config, node, "isupport", NODE_TYPE_BLOCK); 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)); server->connrec->channels = g_strdup(config_node_get_str(node, "rejoin_channels", NULL));
starttls_mode = config_node_get_int(node, "starttls", -1); starttls_mode = config_node_get_int(node, "starttls", STARTTLS_NOTSET);
if (starttls_mode == 0) if (starttls_mode == STARTTLS_DISALLOW)
server->connrec->disallow_starttls = 1; server->connrec->disallow_starttls = 1;
if (starttls_mode == 1) { if (starttls_mode == STARTTLS_ENABLED) {
server->connrec->starttls = 1; server->connrec->starttls = 1;
server->connrec->use_tls = 0; server->connrec->use_tls = 0;
} }