diff -ru bitlbee-orig/protocols/nogaim.c bitlbee-0.92/protocols/nogaim.c --- bitlbee-orig/protocols/nogaim.c Mon Apr 18 17:09:05 2005 +++ bitlbee-0.92/protocols/nogaim.c Mon Apr 18 17:08:43 2005 @@ -1000,6 +1000,12 @@ 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( u->gc->flags & OPT_CONN_HTML) { + char * html = escape_html(msg); + strncpy(buf, html, 8192); + g_free(html); + } return( ((struct gaim_connection *)u->gc)->prpl->send_im( u->gc, u->handle, msg, strlen( msg ), 0 ) ); } @@ -1011,6 +1017,12 @@ 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 ) ); } Only in bitlbee-0.92/protocols: nogaim.c.orig diff -ru bitlbee-orig/protocols/nogaim.h bitlbee-0.92/protocols/nogaim.h --- bitlbee-orig/protocols/nogaim.h Mon Apr 18 17:09:05 2005 +++ bitlbee-0.92/protocols/nogaim.h Mon Apr 18 17:08:43 2005 @@ -314,6 +314,7 @@ 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); #ifdef WITH_MSN Only in bitlbee-0.92/protocols: nogaim.h.orig diff -ru bitlbee-orig/protocols/util.c bitlbee-0.92/protocols/util.c --- bitlbee-orig/protocols/util.c Mon Apr 18 17:09:05 2005 +++ bitlbee-0.92/protocols/util.c Mon Apr 18 17:08:43 2005 @@ -365,7 +365,40 @@ strcpy( start, out ); g_free( out ); -} +} + +char * escape_html(const char *html) +{ + const char *c = html; + GString *ret; + + if (html == NULL) + return NULL; + + ret = g_string_new(""); + + while (*c) { + switch (*c) { + case '&': + ret = g_string_append(ret, "&"); + break; + case '<': + ret = g_string_append(ret, "<"); + break; + case '>': + ret = g_string_append(ret, ">"); + break; + case '"': + ret = g_string_append(ret, """); + break; + default: + ret = g_string_append_c(ret, *c); + } + c++; + } + + return g_string_free(ret, FALSE); +} void info_string_append(GString *str, char *newline, char *name, char *value) { Only in bitlbee-0.92/protocols: util.c.orig