mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-22 09:12:22 -05:00
Removed legacy "IRC" encoding.
This commit is contained in:
parent
5a56f9ea01
commit
ee17ec6b4f
@ -487,8 +487,7 @@ dcc_write_chat (char *nick, char *text)
|
|||||||
if (dcc && dcc->dccstat == STAT_ACTIVE)
|
if (dcc && dcc->dccstat == STAT_ACTIVE)
|
||||||
{
|
{
|
||||||
len = strlen (text);
|
len = strlen (text);
|
||||||
tcp_send_real (NULL, dcc->sok, dcc->serv->encoding, dcc->serv->using_irc,
|
tcp_send_real (NULL, dcc->sok, dcc->serv->encoding, text, len);
|
||||||
text, len);
|
|
||||||
send (dcc->sok, "\n", 1, 0);
|
send (dcc->sok, "\n", 1, 0);
|
||||||
dcc->size += len;
|
dcc->size += len;
|
||||||
fe_dcc_update (dcc);
|
fe_dcc_update (dcc);
|
||||||
@ -518,9 +517,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
|
|||||||
if (dcc->serv->using_cp1255)
|
if (dcc->serv->using_cp1255)
|
||||||
len++; /* include the NUL terminator */
|
len++; /* include the NUL terminator */
|
||||||
|
|
||||||
if (dcc->serv->using_irc) /* using "IRC" encoding (CP1252/UTF-8 hybrid) */
|
if (dcc->serv->encoding == NULL) /* system */
|
||||||
utf = NULL;
|
|
||||||
else if (dcc->serv->encoding == NULL) /* system */
|
|
||||||
utf = g_locale_to_utf8 (line, len, NULL, &utf_len, NULL);
|
utf = g_locale_to_utf8 (line, len, NULL, &utf_len, NULL);
|
||||||
else
|
else
|
||||||
utf = g_convert (line, len, "UTF-8", dcc->serv->encoding, 0, &utf_len, 0);
|
utf = g_convert (line, len, "UTF-8", dcc->serv->encoding, 0, &utf_len, 0);
|
||||||
|
@ -568,7 +568,6 @@ typedef struct server
|
|||||||
unsigned int have_invite:1; /* invite exemptions +I */
|
unsigned int have_invite:1; /* invite exemptions +I */
|
||||||
unsigned int have_cert:1; /* have loaded a cert */
|
unsigned int have_cert:1; /* have loaded a cert */
|
||||||
unsigned int using_cp1255:1; /* encoding is CP1255/WINDOWS-1255? */
|
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 use_who:1; /* whether to use WHO command to get dcc_ip */
|
||||||
unsigned int sasl_mech; /* mechanism for sasl auth */
|
unsigned int sasl_mech; /* mechanism for sasl auth */
|
||||||
unsigned int sent_saslauth:1; /* have sent AUTHENICATE yet */
|
unsigned int sent_saslauth:1; /* have sent AUTHENICATE yet */
|
||||||
|
@ -86,7 +86,7 @@ extern pxProxyFactory *libproxy_factory;
|
|||||||
send via SSL. server/dcc both use this function. */
|
send via SSL. server/dcc both use this function. */
|
||||||
|
|
||||||
int
|
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;
|
int ret;
|
||||||
char *locale;
|
char *locale;
|
||||||
@ -100,18 +100,12 @@ tcp_send_real (void *ssl, int sok, char *encoding, int using_irc, char *buf, int
|
|||||||
const gchar *charset;
|
const gchar *charset;
|
||||||
|
|
||||||
g_get_charset (&charset);
|
g_get_charset (&charset);
|
||||||
locale = g_convert_with_fallback (buf, len, charset, "UTF-8",
|
locale = g_convert_with_fallback (buf, len, charset, "UTF-8", "?", 0, &loc_len, 0);
|
||||||
"?", 0, &loc_len, 0);
|
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (using_irc) /* using "IRC" encoding (CP1252/UTF-8 hybrid) */
|
locale = g_convert_with_fallback (buf, len, encoding, "UTF-8", "?", 0, &loc_len, 0);
|
||||||
/* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locale)
|
if (locale)
|
||||||
@ -148,8 +142,7 @@ server_send_real (server *serv, char *buf, int len)
|
|||||||
|
|
||||||
url_check_line (buf);
|
url_check_line (buf);
|
||||||
|
|
||||||
return tcp_send_real (serv->ssl, serv->sok, serv->encoding, serv->using_irc,
|
return tcp_send_real (serv->ssl, serv->sok, serv->encoding, buf, len);
|
||||||
buf, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* new throttling system, uses the same method as the Undernet
|
/* 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;
|
char *utf_line_allocated = NULL;
|
||||||
|
|
||||||
/* Checks whether we're set to use UTF-8 charset */
|
/* Checks whether we're set to use UTF-8 charset */
|
||||||
if (serv->using_irc || /* 1. using CP1252/UTF-8 Hybrid */
|
if ((serv->encoding == NULL && prefs.utf8_locale) /* Using system default - UTF-8 */ ||
|
||||||
(serv->encoding == NULL && prefs.utf8_locale) || /* OR 2. using system default->UTF-8 */
|
g_ascii_strcasecmp (serv->encoding, "UTF8") == 0 ||
|
||||||
(serv->encoding != NULL && /* OR 3. explicitly set to UTF-8 */
|
g_ascii_strcasecmp (serv->encoding, "UTF-8") == 0
|
||||||
(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);
|
utf_line_allocated = text_validate (&line, &len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1768,7 +1755,6 @@ server_set_encoding (server *serv, char *new_encoding)
|
|||||||
/* can be left as NULL to indicate system encoding */
|
/* can be left as NULL to indicate system encoding */
|
||||||
serv->encoding = NULL;
|
serv->encoding = NULL;
|
||||||
serv->using_cp1255 = FALSE;
|
serv->using_cp1255 = FALSE;
|
||||||
serv->using_irc = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_encoding)
|
if (new_encoding)
|
||||||
@ -1780,12 +1766,17 @@ server_set_encoding (server *serv, char *new_encoding)
|
|||||||
if (space)
|
if (space)
|
||||||
space[0] = 0;
|
space[0] = 0;
|
||||||
|
|
||||||
/* server_inline() uses these flags */
|
/* server_inline() uses this flag */
|
||||||
if (!g_ascii_strcasecmp (serv->encoding, "CP1255") ||
|
if (g_ascii_strcasecmp (serv->encoding, "CP1255") == 0 || g_ascii_strcasecmp (serv->encoding, "WINDOWS-1255") == 0)
|
||||||
!g_ascii_strcasecmp (serv->encoding, "WINDOWS-1255"))
|
{
|
||||||
serv->using_cp1255 = TRUE;
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ extern GSList *serv_list;
|
|||||||
/* eventually need to keep the tcp_* functions isolated to server.c */
|
/* eventually need to keep the tcp_* functions isolated to server.c */
|
||||||
int tcp_send_len (server *serv, char *buf, int len);
|
int tcp_send_len (server *serv, char *buf, int len);
|
||||||
void tcp_sendf (server *serv, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
|
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);
|
server *server_new (void);
|
||||||
int is_server (server *serv);
|
int is_server (server *serv);
|
||||||
|
@ -1272,13 +1272,6 @@ servlist_check_encoding (char *charset)
|
|||||||
if (c)
|
if (c)
|
||||||
c[0] = 0;
|
c[0] = 0;
|
||||||
|
|
||||||
if (!g_ascii_strcasecmp (charset, "IRC")) /* special case */
|
|
||||||
{
|
|
||||||
if (c)
|
|
||||||
c[0] = ' ';
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gic = g_iconv_open (charset, "UTF-8");
|
gic = g_iconv_open (charset, "UTF-8");
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
|
@ -90,7 +90,6 @@ static GtkWidget *servlist_open_edit (GtkWidget *parent, ircnet *net);
|
|||||||
static const char *pages[]=
|
static const char *pages[]=
|
||||||
{
|
{
|
||||||
IRC_DEFAULT_CHARSET,
|
IRC_DEFAULT_CHARSET,
|
||||||
"IRC (Latin/Unicode Hybrid)",
|
|
||||||
"ISO-8859-15 (Western Europe)",
|
"ISO-8859-15 (Western Europe)",
|
||||||
"ISO-8859-2 (Central Europe)",
|
"ISO-8859-2 (Central Europe)",
|
||||||
"ISO-8859-7 (Greek)",
|
"ISO-8859-7 (Greek)",
|
||||||
|
Loading…
Reference in New Issue
Block a user