diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2008-01-13 00:15:12 +0000 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2008-01-13 00:15:12 +0000 | 
| commit | fc0cf92a81086903914056b32663479909a6fbff (patch) | |
| tree | 75c817809ae15eefc11d7391993c6e87e301d9e9 /irc.c | |
| parent | 59f527b6eefaae452533170f52a96903ef63a209 (diff) | |
Different handling of charset mismatches before login time. Ignoring a
USER command because of encoding issues isn't too great, so let's simply
replace them. The information isn't really used anywhere anyway.
Diffstat (limited to 'irc.c')
| -rw-r--r-- | irc.c | 16 | 
1 files changed, 15 insertions, 1 deletions
| @@ -324,7 +324,10 @@ void irc_process( irc_t *irc )  				conv[IRC_MAX_LINE] = 0;  				if( do_iconv( cs, "UTF-8", lines[i], conv, 0, IRC_MAX_LINE - 2 ) == -1 )  				{ +					/* GLib can do strange things if things are not in the expected charset, +					   so let's be a little bit paranoid here: */  					if( irc->status & USTATUS_LOGGED_IN ) +					{  						irc_usermsg( irc, "Error: Charset mismatch detected. The charset "  						                  "setting is currently set to %s, so please make "  						                  "sure your IRC client will send and accept text in " @@ -332,7 +335,18 @@ void irc_process( irc_t *irc )  						                  "expect by changing the charset setting. See "  						                  "`help set charset' for more information. Your "  						                  "message was ignored.", cs ); -					*conv = 0; +						*conv = 0; +					} +					else +					{ +						irc_write( irc, ":%s NOTICE AUTH :%s", irc->myhost, +						           "Warning: invalid (non-UTF8) characters received at login time." ); +						 +						strncpy( conv, lines[i], IRC_MAX_LINE ); +						for( temp = conv; *temp; temp ++ ) +							if( *temp & 0x80 ) +								*temp = '?'; +					}  				}  				lines[i] = conv;  			} | 
