diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-03-31 23:09:36 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-03-31 23:09:36 +0200 |
commit | 7d31002c391868a24693eadaf1c9c6024e1a30cb (patch) | |
tree | 48402adc61e0987e1681636a0feedf04f25cd688 /irc.c | |
parent | e27661d09e8c3fc85c979d4769ba20d1d3c289e2 (diff) |
Tested and fixed one issue, and got rid of one more superfluous iconv call.
Diffstat (limited to 'irc.c')
-rw-r--r-- | irc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -354,6 +354,8 @@ void irc_process( irc_t *irc ) for( i = 0; *lines[i] != '\0'; i ++ ) { + char conv[IRC_MAX_LINE+1]; + /* [WvG] Because irc_tokenize splits at every newline, the lines[] list should end with an empty string. This is why this actually works. Took me a while to figure out, Maurits. :-P */ @@ -366,13 +368,11 @@ void irc_process( irc_t *irc ) break; } - if( ( cs = set_getstr( irc, "charset" ) ) ) + if( ( cs = set_getstr( irc, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) ) { - char conv[IRC_MAX_LINE+1]; - conv[IRC_MAX_LINE] = 0; if( do_iconv( cs, "UTF-8", lines[i], conv, 0, IRC_MAX_LINE - 2 ) != -1 ) - strcpy( lines[i], conv ); + lines[i] = conv; } if( ( cmd = irc_parse_line( lines[i] ) ) == NULL ) @@ -587,7 +587,7 @@ void irc_vawrite( irc_t *irc, char *format, va_list params ) g_vsnprintf( line, IRC_MAX_LINE - 2, format, params ); strip_newlines( line ); - if( ( cs = set_getstr( irc, "charset" ) ) ) + if( ( cs = set_getstr( irc, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) ) { char conv[IRC_MAX_LINE+1]; |