summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-12-18 13:43:01 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-12-18 13:43:01 -0300
commit014b242df803089c34084de3d806a7c4e4dad75e (patch)
tree12dd5534a445fedc63b8219e48951bff0b3d2283 /src
parentd049be950cfaca6311b575890e81521d62db68d7 (diff)
parentbb7a03e9f68a775ca93dd6ad8ea61e4f1d2ba81b (diff)
Merge remote-tracking branch 'upstream/master' into default
Diffstat (limited to 'src')
-rw-r--r--src/common/fe.h1
-rw-r--r--src/common/hexchat.h2
-rw-r--r--src/common/inbound.c29
-rw-r--r--src/common/modes.c8
-rw-r--r--src/common/outbound.c29
-rw-r--r--src/common/proto-irc.c2
-rw-r--r--src/common/servlist.c5
-rw-r--r--src/common/sysinfo/win32/backend.c2
-rw-r--r--src/common/util.c5
-rw-r--r--src/fe-gtk/chanlist.c2
-rw-r--r--src/fe-gtk/dccgui.c2
-rw-r--r--src/fe-gtk/fe-gtk.c4
-rw-r--r--src/fe-gtk/fkeys.c2
-rw-r--r--src/fe-gtk/gtkutil.c12
-rw-r--r--src/fe-gtk/gtkutil.h2
-rw-r--r--src/fe-gtk/menu.c2
-rw-r--r--src/fe-gtk/plugin-notification.c2
-rw-r--r--src/fe-gtk/plugingui.c2
-rw-r--r--src/fe-gtk/rawlog.c2
-rw-r--r--src/fe-gtk/setup.c18
-rw-r--r--src/fe-gtk/sexy-spell-entry.c12
-rw-r--r--src/fe-gtk/textgui.c4
-rw-r--r--src/fe-gtk/urlgrab.c2
-rw-r--r--src/fe-gtk/xtext.c2
24 files changed, 109 insertions, 44 deletions
diff --git a/src/common/fe.h b/src/common/fe.h
index 9da4e230..b8a6279e 100644
--- a/src/common/fe.h
+++ b/src/common/fe.h
@@ -141,6 +141,7 @@ void fe_get_int (char *prompt, int def, void *callback, void *ud);
 #define FRF_NOASKOVERWRITE 32	/* don't ask to overwrite existing files */
 #define FRF_EXTENSIONS 64		/* specify file extensions to be displayed */
 #define FRF_MIMETYPES 128		/* specify file mimetypes to be displayed */
+#define FRF_MODAL 256           /* dialog should be modal to parent */
 void fe_get_file (const char *title, char *initial,
 				 void (*callback) (void *userdata, char *file), void *userdata,
 				 int flags);
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index 43a5f43a..470dd4ad 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -501,7 +501,7 @@ typedef struct server
 	int joindelay_tag;				/* waiting before we send JOIN */
 	char hostname[128];				/* real ip number */
 	char servername[128];			/* what the server says is its name */
-	char password[86];
+	char password[1024];
 	char nick[NICKLEN];
 	char linebuf[8704];				/* RFC says 512 chars including \r\n, IRCv3 message tags add 8191, plus the NUL byte */
 	char *last_away_reason;
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 3c505a57..a591dc48 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -1474,10 +1474,17 @@ inbound_user_info (session *sess, char *chan, char *user, char *host,
 		for (list = sess_list; list; list = list->next)
 		{
 			sess = list->data;
-			if (sess->type == SESS_CHANNEL && sess->server == serv)
+			if (sess->server != serv)
+				continue;
+
+			if (sess->type == SESS_CHANNEL)
 			{
 				userlist_add_hostname (sess, nick, uhost, realname, servname, account, away);
 			}
+			else if (sess->type == SESS_DIALOG && uhost && !serv->p_cmp (sess->channel, nick))
+			{
+				set_topic (sess, uhost, uhost);
+			}
 		}
 	}
 
@@ -1728,6 +1735,7 @@ static const char * const supported_caps[] = {
 	"setname",
 	"invite-notify",
 	"account-tag",
+	"extended-monitor",
 
 	/* ZNC */
 	"znc.in/server-time-iso",
@@ -1929,7 +1937,24 @@ inbound_sasl_authenticate (server *serv, char *data)
 			return;
 		}
 
-		tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass);
+		/* long SASL passwords must be split into 400-byte chunks
+		   https://ircv3.net/specs/extensions/sasl-3.1#the-authenticate-command */
+		size_t pass_len = strlen (pass);
+		if (pass_len <= 400)
+			tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass);
+		else
+		{
+			size_t sent = 0;
+			while (sent < pass_len)
+			{
+				char *pass_chunk = g_strndup (pass + sent, 400);
+				tcp_sendf (serv, "AUTHENTICATE %s\r\n", pass_chunk);
+				sent += 400;
+				g_free (pass_chunk);
+			}
+		}
+		if (pass_len % 400 == 0)
+			tcp_sendf (serv, "AUTHENTICATE +\r\n");
 		g_free (pass);
 
 		
diff --git a/src/common/modes.c b/src/common/modes.c
index 756f0858..d8fd75aa 100644
--- a/src/common/modes.c
+++ b/src/common/modes.c
@@ -918,8 +918,12 @@ inbound_005 (server * serv, char *word[], const message_tags_data *tags_data)
 			server_set_encoding (serv, "UTF-8");
 		} else if (g_strcmp0 (tokname, "NAMESX") == 0)
 		{
-									/* 12345678901234567 */
-			tcp_send_len (serv, "PROTOCTL NAMESX\r\n", 17);
+			if (tokadding && !serv->have_namesx)
+			{
+				/* only use protoctl if the server doesn't have the equivalent cap */
+				tcp_send_len (serv, "PROTOCTL NAMESX\r\n", 17);
+				serv->have_namesx = TRUE;
+			}
 		} else if (g_strcmp0 (tokname, "WHOX") == 0)
 		{
 			serv->have_whox = tokadding;
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 6f0241be..b9f88196 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -3249,7 +3249,7 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 		int offset = 0;
 
 #ifdef USE_OPENSSL
-		int use_ssl = FALSE;
+		int use_ssl = TRUE;
 		int use_ssl_noverify = FALSE;
 		if (g_strcmp0 (word[2], "-ssl") == 0)
 		{
@@ -3261,6 +3261,11 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 			use_ssl = TRUE;
 			use_ssl_noverify = TRUE;
 			offset++;	/* args move up by 1 word */
+		} else if (g_strcmp0 (word[2], "-insecure") == 0)
+		{
+			use_ssl = FALSE;
+			use_ssl_noverify = FALSE;
+			offset++;	/* args move up by 1 word */
 		}
 		serv->use_ssl = use_ssl;
 		serv->accept_invalid_cert = use_ssl_noverify;
@@ -3450,8 +3455,10 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 	char *pass = NULL;
 	char *channel = NULL;
 	char *key = NULL;
-	int use_ssl = FALSE;
+#ifdef USE_OPENSSL
+	int use_ssl = TRUE;
 	int use_ssl_noverify = FALSE;
+#endif
 	int is_url = TRUE;
 	server *serv = sess->server;
 	ircnet *net = NULL;
@@ -3469,6 +3476,11 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 		use_ssl_noverify = TRUE;
 		offset++;	/* args move up by 1 word */
 	}
+	else if (g_strcmp0 (word[2], "-insecure") == 0)
+	{
+		use_ssl = FALSE;
+		offset++;	/* args move up by 1 word */
+	}
 #endif
 
 	if (!parse_irc_url (word[2 + offset], &server_name, &port, &channel, &key, &use_ssl))
@@ -3509,6 +3521,13 @@ cmd_server (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 		use_ssl = TRUE;
 #endif
 	}
+	else if (port[0] == '-')
+	{
+		port++;
+#ifdef USE_OPENSSL
+		use_ssl = FALSE;
+#endif
+	}
 
 	if (*pass)
 	{
@@ -3564,7 +3583,7 @@ cmd_servchan (struct session *sess, char *tbuf, char *word[],
 	int offset = 0;
 
 #ifdef USE_OPENSSL
-	if (g_strcmp0 (word[2], "-ssl") == 0 || g_strcmp0 (word[2], "-ssl-noverify") == 0)
+	if (g_strcmp0 (word[2], "-ssl") == 0 || g_strcmp0 (word[2], "-ssl-noverify") == 0 || g_strcmp0 (word[2], "-insecure") == 0)
 		offset++;
 #endif
 
@@ -4098,14 +4117,14 @@ const struct commands xc_cmds[] = {
 	{"SEND", cmd_send, 0, 0, 1, N_("SEND <nick> [<file>]")},
 #ifdef USE_OPENSSL
 	{"SERVCHAN", cmd_servchan, 0, 0, 1,
-	 N_("SERVCHAN [-ssl|-ssl-noverify] <host> <port> <channel>, connects and joins a channel")},
+	 N_("SERVCHAN [-insecure|-ssl|-ssl-noverify] <host> <port> <channel>, connects and joins a channel using ssl unless otherwise specified")},
 #else
 	{"SERVCHAN", cmd_servchan, 0, 0, 1,
 	 N_("SERVCHAN <host> <port> <channel>, connects and joins a channel")},
 #endif
 #ifdef USE_OPENSSL
 	{"SERVER", cmd_server, 0, 0, 1,
-	 N_("SERVER [-ssl|-ssl-noverify] <host> [<port>] [<password>], connects to a server, the default port is 6667 for normal connections, and 6697 for ssl connections")},
+	 N_("SERVER [-insecure|-ssl|-ssl-noverify] <host> [<port>] [<password>], connects to a server using ssl unless otherwise specified, the default port is 6697 for ssl connections and 6667 for insecure connections")},
 #else
 	{"SERVER", cmd_server, 0, 0, 1,
 	 N_("SERVER <host> [<port>] [<password>], connects to a server, the default port is 6667")},
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index 32cc47f2..5b8e02c4 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -461,7 +461,7 @@ channel_date (session *sess, char *chan, char *timestr,
 }
 
 static int
-trailing_index(const char *word_eol[])
+trailing_index(char *word_eol[])
 {
 	int param_index;
 	for (param_index = 3; param_index < PDIWORDS; ++param_index)
diff --git a/src/common/servlist.c b/src/common/servlist.c
index 160cc9e0..771d7813 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -54,8 +54,6 @@ static const struct defaultserver def[] =
 	/* Invalid hostname in cert */
 	{0,			"irc.2600.net"},
 
-	{"ACN", 0, 0, 0, LOGIN_SASL, 0, TRUE},
-	{0,			"global.acn.gr"},
 
 	{"AfterNET", 0, 0, 0, LOGIN_SASL, 0, TRUE},
 	{0,			"irc.afternet.org"},
@@ -193,9 +191,6 @@ static const struct defaultserver def[] =
 	{"IRC4Fun", 0, 0, 0, LOGIN_SASL, 0, TRUE},
 	{0,				"irc.irc4fun.net"},
 
-	{"IRCHighWay", 0, 0, 0, 0, 0, TRUE},
-	{0,				"irc.irchighway.net"},
-
 	{"IRCNet",		0},
 	{0,				"open.ircnet.net"},
 
diff --git a/src/common/sysinfo/win32/backend.c b/src/common/sysinfo/win32/backend.c
index 67a0fd2b..e2ae83ed 100644
--- a/src/common/sysinfo/win32/backend.c
+++ b/src/common/sysinfo/win32/backend.c
@@ -356,6 +356,8 @@ static char *read_cpu_info (IWbemClassObject *object)
 
 	VariantClear (&max_clock_speed_variant);
 
+	g_strchomp (name_utf8);
+
 	if (cpu_freq_mhz > 1000)
 	{
 		result = g_strdup_printf ("%s (%.2fGHz)", name_utf8, cpu_freq_mhz / 1000.f);
diff --git a/src/common/util.c b/src/common/util.c
index fa0783d4..f06074fc 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1375,11 +1375,16 @@ str_sha256hash (char *string)
 	int i;
 	unsigned char hash[SHA256_DIGEST_LENGTH];
 	char buf[SHA256_DIGEST_LENGTH * 2 + 1];		/* 64 digit hash + '\0' */
+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+	SHA256 (string, strlen (string), hash);
+#else
 	SHA256_CTX sha256;
 
 	SHA256_Init (&sha256);
 	SHA256_Update (&sha256, string, strlen (string));
 	SHA256_Final (hash, &sha256);
+#endif
 
 	for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
 	{
diff --git a/src/fe-gtk/chanlist.c b/src/fe-gtk/chanlist.c
index aeddc417..abf62843 100644
--- a/src/fe-gtk/chanlist.c
+++ b/src/fe-gtk/chanlist.c
@@ -512,7 +512,7 @@ chanlist_save (GtkWidget * wid, server *serv)
 	GtkTreeModel *model = GET_MODEL (serv);
 
 	if (gtk_tree_model_get_iter_first (model, &iter))
-		gtkutil_file_req (_("Select an output filename"), chanlist_filereq_done,
+		gtkutil_file_req (NULL, _("Select an output filename"), chanlist_filereq_done,
 								serv, NULL, NULL, FRF_WRITE);
 }
 
diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c
index 5b8dbac9..728698e3 100644
--- a/src/fe-gtk/dccgui.c
+++ b/src/fe-gtk/dccgui.c
@@ -146,7 +146,7 @@ fe_dcc_send_filereq (struct session *sess, char *nick, int maxcps, int passive)
 	mdc->maxcps = maxcps;
 	mdc->passive = passive;
 
-	gtkutil_file_req (tbuf, dcc_send_filereq_file, mdc, prefs.hex_dcc_dir, NULL, FRF_MULTIPLE|FRF_FILTERISINITIAL);
+	gtkutil_file_req (NULL, tbuf, dcc_send_filereq_file, mdc, prefs.hex_dcc_dir, NULL, FRF_MULTIPLE|FRF_FILTERISINITIAL);
 
 	g_free (tbuf);
 }
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index 7eca0710..38e6172d 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -903,7 +903,7 @@ fe_confirm (const char *message, void (*yesproc)(void *), void (*noproc)(void *)
 	if (dcc->file)
 	{
 		char *filepath = g_build_filename (prefs.hex_dcc_dir, dcc->file, NULL);
-		gtkutil_file_req (message, dcc_saveas_cb, ud, filepath, NULL,
+		gtkutil_file_req (NULL, message, dcc_saveas_cb, ud, filepath, NULL,
 								FRF_WRITE|FRF_NOASKOVERWRITE|FRF_FILTERISINITIAL);
 		g_free (filepath);
 	}
@@ -1216,7 +1216,7 @@ fe_get_file (const char *title, char *initial,
 {
 	/* OK: Call callback once per file, then once more with file=NULL. */
 	/* CANCEL: Call callback once with file=NULL. */
-	gtkutil_file_req (title, callback, userdata, initial, NULL, flags | FRF_FILTERISINITIAL);
+	gtkutil_file_req (NULL, title, callback, userdata, initial, NULL, flags | FRF_FILTERISINITIAL);
 }
 
 void
diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c
index dc4b41bc..6dd16e35 100644
--- a/src/fe-gtk/fkeys.c
+++ b/src/fe-gtk/fkeys.c
@@ -894,7 +894,7 @@ key_save_kbs (void)
 #define STRIP_WHITESPACE \
 	while (buf[0] == ' ' || buf[0] == '\t') \
 		buf++; \
-		len = strlen (buf); \
+	len = strlen (buf); \
 	while (buf[len] == ' ' || buf[len] == '\t') \
 	{ \
 		buf[len] = 0; \
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c
index 674ad4fc..98a971f9 100644
--- a/src/fe-gtk/gtkutil.c
+++ b/src/fe-gtk/gtkutil.c
@@ -190,7 +190,7 @@ gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
 }
 
 void
-gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, char *extensions,
+gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions,
 						int flags)
 {
 	struct file_req *freq;
@@ -269,6 +269,16 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
 							G_CALLBACK (gtkutil_file_req_response), freq);
 	g_signal_connect (G_OBJECT (dialog), "destroy",
 						   G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
+
+	if (parent)
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+	if (flags & FRF_MODAL)
+	{
+		g_assert (parent);
+		gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+	}
+
 	gtk_widget_show (dialog);
 }
 
diff --git a/src/fe-gtk/gtkutil.h b/src/fe-gtk/gtkutil.h
index 0aa36439..c6e380e9 100644
--- a/src/fe-gtk/gtkutil.h
+++ b/src/fe-gtk/gtkutil.h
@@ -25,7 +25,7 @@
 
 typedef void (*filereqcallback) (void *, char *file);
 
-void gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, char *extensions, int flags);
+void gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions, int flags);
 void gtkutil_destroy (GtkWidget * igad, GtkWidget * dgad);
 void gtkutil_destroy_on_esc (GtkWidget *win);
 GtkWidget *gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback,
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c
index 233715e5..76bc3906 100644
--- a/src/fe-gtk/menu.c
+++ b/src/fe-gtk/menu.c
@@ -1362,7 +1362,7 @@ savebuffer_req_done (session *sess, char *file)
 static void
 menu_savebuffer (GtkWidget * wid, gpointer none)
 {
-	gtkutil_file_req (_("Select an output filename"), savebuffer_req_done,
+	gtkutil_file_req (NULL, _("Select an output filename"), savebuffer_req_done,
 							current_sess, NULL, NULL, FRF_WRITE);
 }
 
diff --git a/src/fe-gtk/plugin-notification.c b/src/fe-gtk/plugin-notification.c
index 875b50f4..fc71d22b 100644
--- a/src/fe-gtk/plugin-notification.c
+++ b/src/fe-gtk/plugin-notification.c
@@ -246,7 +246,7 @@ notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, cha
 
 
 int
-notification_plugin_deinit (void)
+notification_plugin_deinit (void *unused_param)
 {
 	notification_backend_deinit ();
 	return 1;
diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c
index 83bb745f..c40ac304 100644
--- a/src/fe-gtk/plugingui.c
+++ b/src/fe-gtk/plugingui.c
@@ -161,7 +161,7 @@ plugingui_load (void)
 {
 	char *sub_dir = g_build_filename (get_xdir(), "addons", NULL);
 
-	gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
+	gtkutil_file_req (NULL, _("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
 							sub_dir, "*."PLUGIN_SUFFIX";*.lua;*.pl;*.py;*.tcl;*.js", FRF_FILTERISINITIAL|FRF_EXTENSIONS);
 
 	g_free (sub_dir);
diff --git a/src/fe-gtk/rawlog.c b/src/fe-gtk/rawlog.c
index 52a77267..666059c6 100644
--- a/src/fe-gtk/rawlog.c
+++ b/src/fe-gtk/rawlog.c
@@ -77,7 +77,7 @@ rawlog_clearbutton (GtkWidget * wid, server *serv)
 static int
 rawlog_savebutton (GtkWidget * wid, server *serv)
 {
-	gtkutil_file_req (_("Save As..."), rawlog_save, serv, NULL, NULL, FRF_WRITE);
+	gtkutil_file_req (NULL, _("Save As..."), rawlog_save, serv, NULL, NULL, FRF_WRITE);
 	return FALSE;
 }
 
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index a7e3a15c..2f0589bd 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -48,6 +48,7 @@ GtkStyle *create_input_style (GtkStyle *);
 
 #define LABEL_INDENT 12
 
+static GtkWidget *setup_window = NULL;
 static int last_selected_page = 0;
 static int last_selected_row = 0; /* sound row */
 static gboolean color_change;
@@ -1105,8 +1106,8 @@ setup_browsefile_cb (GtkWidget *button, GtkWidget *entry)
 	filter = "image/*";
 	filter_type = FRF_MIMETYPES;
 #endif
-	gtkutil_file_req (_("Select an Image File"), setup_filereq_cb,
-					entry, NULL, filter, filter_type|FRF_RECENTLYUSED);
+	gtkutil_file_req (GTK_WINDOW (setup_window), _("Select an Image File"), setup_filereq_cb,
+					entry, NULL, filter, filter_type|FRF_RECENTLYUSED|FRF_MODAL);
 }
 
 static void
@@ -1141,7 +1142,7 @@ setup_fontsel_cancel (GtkWidget *button, GtkFontSelectionDialog *dialog)
 static void
 setup_browsefolder_cb (GtkWidget *button, GtkEntry *entry)
 {
-	gtkutil_file_req (_("Select Download Folder"), setup_filereq_cb, entry, (char*)gtk_entry_get_text (entry), NULL, FRF_CHOOSEFOLDER);
+	gtkutil_file_req (GTK_WINDOW (setup_window), _("Select Download Folder"), setup_filereq_cb, entry, (char*)gtk_entry_get_text (entry), NULL, FRF_CHOOSEFOLDER|FRF_MODAL);
 }
 
 static void
@@ -1154,6 +1155,9 @@ setup_browsefont_cb (GtkWidget *button, GtkWidget *entry)
 	dialog = (GtkFontSelectionDialog *) gtk_font_selection_dialog_new (_("Select font"));
 	font_dialog = (GtkWidget *)dialog;	/* global var */
 
+	gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (setup_window));
+	gtk_window_set_modal (GTK_WINDOW (font_dialog), TRUE);
+
 	sel = (GtkFontSelection *) gtk_font_selection_dialog_get_font_selection (dialog);
 
 	if (gtk_entry_get_text (GTK_ENTRY (entry))[0])
@@ -1457,6 +1461,8 @@ setup_color_cb (GtkWidget *button, gpointer userdata)
 	g_object_set_data (G_OBJECT (ok_button), "b", button);
 	gtk_widget_set_sensitive (help_button, FALSE);
 	gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (cdialog)), color);
+	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (setup_window));
+	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 	gtk_widget_show (dialog);
 
 	g_object_unref (cancel_button);
@@ -1711,8 +1717,8 @@ setup_snd_browse_cb (GtkWidget *button, GtkEntry *entry)
 	filter_type = FRF_MIMETYPES;
 #endif
 
-	gtkutil_file_req (_("Select a sound file"), setup_snd_filereq_cb, entry,
-						sounds_dir, filter, FRF_FILTERISINITIAL|filter_type);
+	gtkutil_file_req (GTK_WINDOW (setup_window), _("Select a sound file"), setup_snd_filereq_cb, entry,
+						sounds_dir, filter, FRF_MODAL|FRF_FILTERISINITIAL|filter_type);
 	g_free (sounds_dir);
 }
 
@@ -2336,8 +2342,6 @@ setup_close_cb (GtkWidget *win, GtkWidget **swin)
 void
 setup_open (void)
 {
-	static GtkWidget *setup_window = NULL;
-
 	if (setup_window)
 	{
 		gtk_window_present (GTK_WINDOW (setup_window));
diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c
index 04ff0f8a..a3042783 100644
--- a/src/fe-gtk/sexy-spell-entry.c
+++ b/src/fe-gtk/sexy-spell-entry.c
@@ -1255,7 +1255,7 @@ void
 sexy_spell_entry_activate_default_languages(SexySpellEntry *entry)
 {
 	GSList *enchant_langs;
-	char *lang, *langs;
+	char *lang, **i, **langs;
 
 	if (!have_enchant)
 		return;
@@ -1265,21 +1265,21 @@ sexy_spell_entry_activate_default_languages(SexySpellEntry *entry)
 
 	enchant_langs = sexy_spell_entry_get_languages(entry);
 
-	langs = g_strdup (prefs.hex_text_spell_langs);
+	langs = g_strsplit_set (prefs.hex_text_spell_langs, ", \t", 0);
 
-	lang = strtok (langs, ",");
-	while (lang != NULL)
+	for (i = langs; *i; i++)
 	{
+		lang = *i;
+
 		if (enchant_has_lang (lang, enchant_langs))
 		{
 			sexy_spell_entry_activate_language_internal (entry, lang, NULL);
 		}
-		lang = strtok (NULL, ",");
 	}
 
 	g_slist_foreach(enchant_langs, (GFunc) g_free, NULL);
 	g_slist_free(enchant_langs);
-	g_free (langs);
+	g_strfreev (langs);
 
 	/* If we don't have any languages activated, use "en" */
 	if (entry->priv->dict_list == NULL)
diff --git a/src/fe-gtk/textgui.c b/src/fe-gtk/textgui.c
index b0f2f392..b5eaf893 100644
--- a/src/fe-gtk/textgui.c
+++ b/src/fe-gtk/textgui.c
@@ -282,7 +282,7 @@ pevent_save_cb (GtkWidget * wid, void *data)
 {
 	if (data)
 	{
-		gtkutil_file_req (_("Print Texts File"), pevent_save_req_cb, NULL,
+		gtkutil_file_req (NULL, _("Print Texts File"), pevent_save_req_cb, NULL,
 								NULL, NULL, FRF_WRITE);
 		return;
 	}
@@ -304,7 +304,7 @@ pevent_load_req_cb (void *arg1, char *file)
 static void
 pevent_load_cb (GtkWidget * wid, void *data)
 {
-	gtkutil_file_req (_("Print Texts File"), pevent_load_req_cb, NULL, NULL, NULL, 0);
+	gtkutil_file_req (NULL, _("Print Texts File"), pevent_load_req_cb, NULL, NULL, NULL, 0);
 }
 
 static void
diff --git a/src/fe-gtk/urlgrab.c b/src/fe-gtk/urlgrab.c
index fd8d8d91..fc2f4b5a 100644
--- a/src/fe-gtk/urlgrab.c
+++ b/src/fe-gtk/urlgrab.c
@@ -145,7 +145,7 @@ url_save_callback (void *arg1, char *file)
 static void
 url_button_save (void)
 {
-	gtkutil_file_req (_("Select an output filename"),
+	gtkutil_file_req (NULL, _("Select an output filename"),
 							url_save_callback, NULL, NULL, NULL, FRF_WRITE);
 }
 
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c
index 6a0fccba..08a5110a 100644
--- a/src/fe-gtk/xtext.c
+++ b/src/fe-gtk/xtext.c
@@ -947,7 +947,7 @@ gtk_xtext_find_char (GtkXText * xtext, int x, int y, int *off, int *out_of_bound
 	textentry *ent;
 	int line;
 	int subline;
-	int outofbounds;
+	int outofbounds = FALSE;
 
 	/* Adjust y value for negative rounding, double to int */
 	if (y < 0)