Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision 192b80a1175690187be4bad30c36d286f8e63eb0)
+++ protocols/nogaim.c	(revision 6adcb6c6bcd96478ec3ab89efcc43bf15d6b12e0)
@@ -37,5 +37,4 @@
 #include "nogaim.h"
 #include <ctype.h>
-#include <iconv.h>
 
 static char *proto_away_alias[8][5] =
@@ -306,21 +305,14 @@
 {
 	va_list params;
-	char text[1024], buf[1024], *acc_id;
-	char *msg;
+	char *text;
 	account_t *a;
 	
 	va_start( params, format );
-	g_vsnprintf( text, sizeof( text ), format, params );
+	text = g_strdup_vprintf( format, params );
 	va_end( params );
 
-	if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&
-	    do_iconv( "UTF8", set_getstr( gc->irc, "charset" ), text, buf, 0, 1024 ) != -1 )
-		msg = buf;
-	else
-		msg = text;
-	
 	if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||
 	    ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )
-		strip_html( msg );
+		strip_html( text );
 	
 	/* Try to find a different connection on the same protocol. */
@@ -329,13 +321,11 @@
 			break;
 	
-	/* If we found one, add the screenname to the acc_id. */
+	/* If we found one, include the screenname in the message. */
 	if( a )
-		acc_id = g_strdup_printf( "%s(%s)", gc->prpl->name, gc->username );
+		irc_usermsg( gc->irc, "%s(%s) - %s", gc->prpl->name, gc->username, text );
 	else
-		acc_id = g_strdup( gc->prpl->name );
-	
-	irc_usermsg( gc->irc, "%s - %s", acc_id, msg );
-	
-	g_free( acc_id );
+		irc_usermsg( gc->irc, "%s - %s", gc->prpl->name, text );
+	
+	g_free( text );
 }
 
@@ -559,20 +549,12 @@
 {
 	user_t *u = user_findhandle( gc, handle );
-	char *name, buf[1024];
 	
 	if( !u ) return;
 	
-	/* Convert all UTF-8 */
-	if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&
-	    do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), realname, buf, 0, sizeof( buf ) ) != -1 )
-		name = buf;
-	else
-		name = realname;
-	
-	if( g_strcasecmp( u->realname, name ) != 0 )
+	if( g_strcasecmp( u->realname, realname ) != 0 )
 	{
 		if( u->realname != u->nick ) g_free( u->realname );
 		
-		u->realname = g_strdup( name );
+		u->realname = g_strdup( realname );
 		
 		if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( gc->irc, "display_namechanges" ) )
@@ -680,5 +662,4 @@
 	irc_t *irc = gc->irc;
 	user_t *u;
-	char buf[8192];
 	
 	u = user_findhandle( gc, handle );
@@ -722,8 +703,4 @@
 		strip_html( msg );
 
-	if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&
-	    do_iconv( "UTF-8", set_getstr( irc, "charset" ), msg, buf, 0, 8192 ) != -1 )
-		msg = buf;
-	
 	while( strlen( msg ) > 425 )
 	{
@@ -822,5 +799,4 @@
 	struct conversation *c;
 	user_t *u;
-	char buf[8192];
 	
 	/* Gaim sends own messages through this too. IRC doesn't want this, so kill them */
@@ -834,8 +810,4 @@
 	    ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )
 		strip_html( msg );
-	
-	if( g_strncasecmp( set_getstr( gc->irc, "charset" ), "none", 4 ) != 0 &&
-	    do_iconv( "UTF-8", set_getstr( gc->irc, "charset" ), msg, buf, 0, 8192 ) != -1 )
-		msg = buf;
 	
 	if( c && u )
@@ -1053,86 +1025,33 @@
 int serv_send_im( irc_t *irc, user_t *u, char *msg, int flags )
 {
-	char buf[8192];
-	
-	if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&
-	    do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 )
+	char *buf = NULL;
+	int st;
+	
+	if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+	{
+		buf = escape_html( msg );
 		msg = buf;
-
-	if( ( u->gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
-	{
-		char *html;
-		
-		html = escape_html( msg );
-		strncpy( buf, html, 8192 );
-		g_free( html );
-		
+	}
+	
+	st = ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags );
+	g_free( buf );
+	
+	return st;
+}
+
+int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg )
+{
+	char *buf = NULL;
+	int st;
+	
+	if( ( gc->flags & OPT_CONN_HTML ) && ( g_strncasecmp( msg, "<html>", 6 ) != 0 ) )
+	{
+		buf = escape_html( msg );
 		msg = buf;
 	}
 	
-	return( ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), flags ) );
-}
-
-int serv_send_chat( irc_t *irc, struct gaim_connection *gc, int id, char *msg )
-{
-	char buf[8192];
-	
-	if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&
-	    do_iconv( set_getstr( irc, "charset" ), "UTF-8", msg, buf, 0, 8192 ) != -1 )
-		msg = buf;
-
-	if( gc->flags & OPT_CONN_HTML) {
-		char * html = escape_html(msg);
-		strncpy(buf, html, 8192);
-		g_free(html);
-	}
-	
-	return( gc->prpl->chat_send( gc, id, msg ) );
-}
-
-/* Convert from one charset to another.
-   
-   from_cs, to_cs: Source and destination charsets
-   src, dst: Source and destination strings
-   size: Size if src. 0 == use strlen(). strlen() is not reliable for UNICODE/UTF16 strings though.
-   maxbuf: Maximum number of bytes to write to dst
-   
-   Returns the number of bytes written to maxbuf or -1 on an error.
-*/
-signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf )
-{
-	iconv_t cd;
-	size_t res;
-	size_t inbytesleft, outbytesleft;
-	char *inbuf = src;
-	char *outbuf = dst;
-	
-	cd = iconv_open( to_cs, from_cs );
-	if( cd == (iconv_t) -1 )
-		return( -1 );
-	
-	inbytesleft = size ? size : strlen( src );
-	outbytesleft = maxbuf - 1;
-	res = iconv( cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft );
-	*outbuf = '\0';
-	iconv_close( cd );
-	
-	if( res == (size_t) -1 )
-		return( -1 );
-	else
-		return( outbuf - dst );
-}
-
-char *set_eval_charset( irc_t *irc, set_t *set, char *value )
-{
-	iconv_t cd;
-
-	if ( g_strncasecmp( value, "none", 4 ) == 0 )
-		return( value );
-
-	cd = iconv_open( "UTF-8", value );
-	if( cd == (iconv_t) -1 )
-		return( NULL );
-
-	iconv_close( cd );
-	return( value );
-}
+	st = gc->prpl->chat_send( gc, id, msg );
+	g_free( buf );
+	
+	return st;
+}
Index: protocols/nogaim.h
===================================================================
--- protocols/nogaim.h	(revision 192b80a1175690187be4bad30c36d286f8e63eb0)
+++ protocols/nogaim.h	(revision 6adcb6c6bcd96478ec3ab89efcc43bf15d6b12e0)
@@ -207,7 +207,4 @@
 int serv_send_chat(irc_t *irc, struct gaim_connection *gc, int id, char *msg );
 
-G_MODULE_EXPORT signed int do_iconv( char *from_cs, char *to_cs, char *src, char *dst, size_t size, size_t maxbuf );
-char *set_eval_charset( irc_t *irc, set_t *set, char *value );
-
 void nogaim_init();
 int proto_away( struct gaim_connection *gc, char *away );
@@ -258,16 +255,4 @@
 G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );
 
-/* util.c */
-G_MODULE_EXPORT void strip_linefeed( gchar *text );
-G_MODULE_EXPORT char *add_cr( char *text );
-G_MODULE_EXPORT char *tobase64( const char *text );
-G_MODULE_EXPORT char *normalize( const char *s );
-G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec );
-G_MODULE_EXPORT void strip_html( char *msg );
-G_MODULE_EXPORT char *escape_html( const char *html );
-G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);
-G_MODULE_EXPORT char *ipv6_wrap( char *src );
-G_MODULE_EXPORT char *ipv6_unwrap( char *src );
-
 /* prefs.c */
 G_MODULE_EXPORT void build_block_list();
