summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2015-01-18 02:10:03 -0800
committerArnavion <arnavion@gmail.com>2015-01-18 02:10:03 -0800
commitee17ec6b4f0d0d198f0a8efa1eaf4e93646140e1 (patch)
tree1f3250faef10d9da12d6f8e1777f0edea8487be7 /src/common
parent5a56f9ea01986dfcb3da856177398a455bf7b38c (diff)
Removed legacy "IRC" encoding.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dcc.c7
-rw-r--r--src/common/hexchat.h1
-rw-r--r--src/common/server.c49
-rw-r--r--src/common/server.h2
-rw-r--r--src/common/servlist.c7
5 files changed, 23 insertions, 43 deletions
diff --git a/src/common/dcc.c b/src/common/dcc.c
index 97cd5f14..e44438a5 100644
--- a/src/common/dcc.c
+++ b/src/common/dcc.c
@@ -487,8 +487,7 @@ dcc_write_chat (char *nick, char *text)
 	if (dcc && dcc->dccstat == STAT_ACTIVE)
 	{
 		len = strlen (text);
-		tcp_send_real (NULL, dcc->sok, dcc->serv->encoding, dcc->serv->using_irc,
-							text, len);
+		tcp_send_real (NULL, dcc->sok, dcc->serv->encoding, text, len);
 		send (dcc->sok, "\n", 1, 0);
 		dcc->size += len;
 		fe_dcc_update (dcc);
@@ -518,9 +517,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
 	if (dcc->serv->using_cp1255)
 		len++;	/* include the NUL terminator */
 
-	if (dcc->serv->using_irc) /* using "IRC" encoding (CP1252/UTF-8 hybrid) */
-		utf = NULL;
-	else if (dcc->serv->encoding == NULL)     /* system */
+	if (dcc->serv->encoding == NULL)     /* system */
 		utf = g_locale_to_utf8 (line, len, NULL, &utf_len, NULL);
 	else
 		utf = g_convert (line, len, "UTF-8", dcc->serv->encoding, 0, &utf_len, 0);
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index a5b61a26..4bc6eb20 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -568,7 +568,6 @@ typedef struct server
 	unsigned int have_invite:1;	/* invite exemptions +I */
 	unsigned int have_cert:1;	/* have loaded a cert */
 	unsigned int using_cp1255:1;	/* encoding is CP1255/WINDOWS-1255? */
-	unsigned int using_irc:1;		/* encoding is "IRC" (CP1252/UTF-8 hybrid)? */
 	unsigned int use_who:1;			/* whether to use WHO command to get dcc_ip */
 	unsigned int sasl_mech;			/* mechanism for sasl auth */
 	unsigned int sent_saslauth:1;	/* have sent AUTHENICATE yet */
diff --git a/src/common/server.c b/src/common/server.c
index f7c45d99..bf860ac1 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -86,7 +86,7 @@ extern pxProxyFactory *libproxy_factory;
    send via SSL. server/dcc both use this function. */
 
 int
-tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len)
+tcp_send_real (void *ssl, int sok, char *encoding, char *buf, int len)
 {
 	int ret;
 	char *locale;
@@ -100,18 +100,12 @@ tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int
 			const gchar *charset;
 
 			g_get_charset (&charset);
-			locale = g_convert_with_fallback (buf, len, charset, "UTF-8",
-														 "?", 0, &loc_len, 0);
+			locale = g_convert_with_fallback (buf, len, charset, "UTF-8", "?", 0, &loc_len, 0);
 		}
-	} else
+	}
+	else
 	{
-		if (using_irc)	/* using "IRC" encoding (CP1252/UTF-8 hybrid) */
-			/* if all chars fit inside CP1252, use that. Otherwise this
-			   returns NULL and we send UTF-8. */
-			locale = g_convert (buf, len, "CP1252", "UTF-8", 0, &loc_len, 0);
-		else
-			locale = g_convert_with_fallback (buf, len, encoding, "UTF-8",
-														 "?", 0, &loc_len, 0);
+		locale = g_convert_with_fallback (buf, len, encoding, "UTF-8", "?", 0, &loc_len, 0);
 	}
 
 	if (locale)
@@ -148,8 +142,7 @@ server_send_real (server *serv, char *buf, int len)
 
 	url_check_line (buf);
 
-	return tcp_send_real (serv->ssl, serv->sok, serv->encoding, serv->using_irc,
-								 buf, len);
+	return tcp_send_real (serv->ssl, serv->sok, serv->encoding, buf, len);
 }
 
 /* new throttling system, uses the same method as the Undernet
@@ -297,17 +290,11 @@ server_inline (server *serv, char *line, gssize len)
 	char *utf_line_allocated = NULL;
 
 	/* Checks whether we're set to use UTF-8 charset */
-	if (serv->using_irc ||				/* 1. using CP1252/UTF-8 Hybrid */
-		(serv->encoding == NULL && prefs.utf8_locale) || /* OR 2. using system default->UTF-8 */
-	    (serv->encoding != NULL &&				/* OR 3. explicitly set to UTF-8 */
-		 (g_ascii_strcasecmp (serv->encoding, "UTF8") == 0 ||
-		  g_ascii_strcasecmp (serv->encoding, "UTF-8") == 0)))
+	if ((serv->encoding == NULL && prefs.utf8_locale) /* Using system default - UTF-8 */ ||
+		g_ascii_strcasecmp (serv->encoding, "UTF8") == 0 ||
+		g_ascii_strcasecmp (serv->encoding, "UTF-8") == 0
+	)
 	{
-		/* The user has the UTF-8 charset set, either via /charset
-		command or from his UTF-8 locale. Thus, we first try the
-		UTF-8 charset, and if we fail to convert, we assume
-		it to be ISO-8859-1 (see text_validate). */
-
 		utf_line_allocated = text_validate (&line, &len);
 	}
 	else
@@ -1768,7 +1755,6 @@ server_set_encoding (server *serv, char *new_encoding)
 		/* can be left as NULL to indicate system encoding */
 		serv->encoding = NULL;
 		serv->using_cp1255 = FALSE;
-		serv->using_irc = FALSE;
 	}
 
 	if (new_encoding)
@@ -1780,12 +1766,17 @@ server_set_encoding (server *serv, char *new_encoding)
 		if (space)
 			space[0] = 0;
 
-		/* server_inline() uses these flags */
-		if (!g_ascii_strcasecmp (serv->encoding, "CP1255") ||
-			 !g_ascii_strcasecmp (serv->encoding, "WINDOWS-1255"))
+		/* server_inline() uses this flag */
+		if (g_ascii_strcasecmp (serv->encoding, "CP1255") == 0 || g_ascii_strcasecmp (serv->encoding, "WINDOWS-1255") == 0)
+		{
 			serv->using_cp1255 = TRUE;
-		else if (!g_ascii_strcasecmp (serv->encoding, "IRC"))
-			serv->using_irc = TRUE;
+		}
+		else if (g_ascii_strcasecmp (serv->encoding, "IRC") == 0)
+		{
+			/* Default legacy "IRC" encoding to utf-8. */
+			g_free (serv->encoding);
+			serv->encoding = g_strdup ("UTF-8");
+		}
 	}
 }
 
diff --git a/src/common/server.h b/src/common/server.h
index ac032a0e..211f407c 100644
--- a/src/common/server.h
+++ b/src/common/server.h
@@ -25,7 +25,7 @@ extern GSList *serv_list;
 /* eventually need to keep the tcp_* functions isolated to server.c */
 int tcp_send_len (server *serv, char *buf, int len);
 void tcp_sendf (server *serv, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
-int tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int len);
+int tcp_send_real (void *ssl, int sok, char *encoding, char *buf, int len);
 
 server *server_new (void);
 int is_server (server *serv);
diff --git a/src/common/servlist.c b/src/common/servlist.c
index b1b31026..2ce64d13 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -1272,13 +1272,6 @@ servlist_check_encoding (char *charset)
 	if (c)
 		c[0] = 0;
 
-	if (!g_ascii_strcasecmp (charset, "IRC")) /* special case */
-	{
-		if (c)
-			c[0] = ' ';
-		return TRUE;
-	}
-
 	gic = g_iconv_open (charset, "UTF-8");
 
 	if (c)