From 747a52aae8806a9072a23ea68212767f352ac431 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 23 May 2021 06:58:18 +0100 Subject: [PATCH] Default new servers to use TLS if built with OpenSSL. --- src/common/outbound.c | 2 +- src/common/servlist.c | 3 +++ src/fe-gtk/servlistgui.c | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/common/outbound.c b/src/common/outbound.c index 614aad38..e8d35c96 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3930,7 +3930,7 @@ cmd_voice (struct session *sess, char *tbuf, char *word[], char *word_eol[]) const struct commands xc_cmds[] = { {"ADDBUTTON", cmd_addbutton, 0, 0, 1, N_("ADDBUTTON , adds a button under the user-list")}, - {"ADDSERVER", cmd_addserver, 0, 0, 1, N_("ADDSERVER , adds a new network with a new server to the network list")}, + {"ADDSERVER", cmd_addserver, 0, 0, 1, N_("ADDSERVER , adds a new network with a new server to the network list")}, {"ALLCHAN", cmd_allchannels, 0, 0, 1, N_("ALLCHAN , sends a command to all channels you're in")}, {"ALLCHANL", cmd_allchannelslocal, 0, 0, 1, diff --git a/src/common/servlist.c b/src/common/servlist.c index 79a5694b..45bc4999 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -947,6 +947,9 @@ servlist_net_add (char *name, char *comment, int prepend) net = g_new0 (ircnet, 1); net->name = g_strdup (name); net->flags = FLAG_CYCLE | FLAG_USE_GLOBAL | FLAG_USE_PROXY; +#ifdef USE_OPENSSL + net->flags |= FLAG_USE_SSL; +#endif if (prepend) network_list = g_slist_prepend (network_list, net); diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c index b22330ac..0220525d 100644 --- a/src/fe-gtk/servlistgui.c +++ b/src/fe-gtk/servlistgui.c @@ -39,6 +39,12 @@ #define SERVLIST_X_PADDING 4 /* horizontal paddig in the network editor */ #define SERVLIST_Y_PADDING 0 /* vertical padding in the network editor */ +#ifdef USE_OPENSSL +# define DEFAULT_SERVER "irc.example.com/6697" +#else +# define DEFAULT_SERVER "irc.example.com/6667" +#endif + /* servlistgui.c globals */ static GtkWidget *serverlist_win = NULL; static GtkWidget *networks_tree; /* network TreeView */ @@ -299,7 +305,7 @@ servlist_networks_populate_ (GtkWidget *treeview, GSList *netlist, gboolean favo if (!netlist) { net = servlist_net_add (_("New Network"), "", FALSE); - servlist_server_add (net, "newserver/6667"); + servlist_server_add (net, DEFAULT_SERVER); netlist = network_list; } store = (GtkListStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); @@ -434,10 +440,10 @@ servlist_addserver (void) return; store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (edit_trees[SERVER_TREE]))); - servlist_server_add (selected_net, "newserver/6667"); + servlist_server_add (selected_net, DEFAULT_SERVER); gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, 0, "newserver/6667", 1, TRUE, -1); + gtk_list_store_set (store, &iter, 0, DEFAULT_SERVER, 1, TRUE, -1); /* select this server */ servlist_select_and_show (GTK_TREE_VIEW (edit_trees[SERVER_TREE]), &iter, store); @@ -498,7 +504,7 @@ servlist_addnet_cb (GtkWidget *item, GtkTreeView *treeview) net = servlist_net_add (_("New Network"), "", TRUE); net->encoding = g_strdup (IRC_DEFAULT_CHARSET); - servlist_server_add (net, "newserver/6667"); + servlist_server_add (net, DEFAULT_SERVER); store = (GtkListStore *)gtk_tree_view_get_model (treeview); gtk_list_store_prepend (store, &iter);