Index: lib/misc.c
===================================================================
--- lib/misc.c	(revision 01827732cb3d5289e8071d8317b95d5c4043857c)
+++ lib/misc.c	(revision 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d)
@@ -88,4 +88,5 @@
 	{ "gt",     ">" },
 	{ "amp",    "&" },
+	{ "apos",   "'" },
 	{ "quot",   "\"" },
 	{ "aacute", "á" },
@@ -119,4 +120,5 @@
 	char *s = out, *cs;
 	int i, matched;
+	int taglen;
 	
 	memset( out, 0, strlen( in ) + 1 );
@@ -135,7 +137,16 @@
 				in ++;
 			
+			taglen = in-cs-1;   /* not <0 because the above loop runs at least once */
 			if( *in )
 			{
-				if( g_strncasecmp( cs+1, "br", 2) == 0 )
+				if( g_strncasecmp( cs+1, "b", taglen) == 0 )
+					*(s++) = '\x02';
+				else if( g_strncasecmp( cs+1, "/b", taglen) == 0 )
+					*(s++) = '\x02';
+				else if( g_strncasecmp( cs+1, "i", taglen) == 0 )
+					*(s++) = '\x1f';
+				else if( g_strncasecmp( cs+1, "/i", taglen) == 0 )
+					*(s++) = '\x1f';
+				else if( g_strncasecmp( cs+1, "br", 2) == 0 )
 					*(s++) = '\n';
 				in ++;
Index: lib/ssl_bogus.c
===================================================================
--- lib/ssl_bogus.c	(revision 01827732cb3d5289e8071d8317b95d5c4043857c)
+++ lib/ssl_bogus.c	(revision 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d)
@@ -27,4 +27,8 @@
 
 int ssl_errno;
+
+void ssl_init( void )
+{
+}
 
 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
@@ -66,2 +70,7 @@
 	return 0;
 }
+
+int ssl_pending( void *conn )
+{
+	return 0;
+}
Index: lib/ssl_client.h
===================================================================
--- lib/ssl_client.h	(revision 01827732cb3d5289e8071d8317b95d5c4043857c)
+++ lib/ssl_client.h	(revision 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d)
@@ -47,4 +47,7 @@
 
 
+/* Perform any global initialization the SSL library might need. */
+G_MODULE_EXPORT void ssl_init( void );
+
 /* Connect to host:port, call the given function when the connection is
    ready to be used for SSL traffic. This is all done asynchronously, no
Index: lib/ssl_gnutls.c
===================================================================
--- lib/ssl_gnutls.c	(revision 01827732cb3d5289e8071d8317b95d5c4043857c)
+++ lib/ssl_gnutls.c	(revision 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d)
@@ -60,4 +60,11 @@
 static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
 
+
+void ssl_init( void )
+{
+	gnutls_global_init();
+	initialized = TRUE;
+	atexit( gnutls_global_deinit );
+}
 
 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
@@ -122,7 +129,5 @@
 	if( !initialized )
 	{
-		gnutls_global_init();
-		initialized = TRUE;
-		atexit( gnutls_global_deinit );
+		ssl_init();
 	}
 	
Index: lib/ssl_nss.c
===================================================================
--- lib/ssl_nss.c	(revision 01827732cb3d5289e8071d8317b95d5c4043857c)
+++ lib/ssl_nss.c	(revision 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d)
@@ -91,4 +91,12 @@
 
 
+void ssl_init( void )
+{
+	PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
+	NSS_NoDB_Init(NULL);
+	NSS_SetDomesticPolicy();
+	initialized = TRUE;
+}
+
 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
 {
@@ -107,7 +115,5 @@
 	if( !initialized )
 	{
-		PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
-		NSS_NoDB_Init(NULL);
-		NSS_SetDomesticPolicy();
+		ssl_init();
 	}
 
Index: lib/ssl_openssl.c
===================================================================
--- lib/ssl_openssl.c	(revision 01827732cb3d5289e8071d8317b95d5c4043857c)
+++ lib/ssl_openssl.c	(revision 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d)
@@ -56,4 +56,10 @@
 static gboolean ssl_handshake( gpointer data, gint source, b_input_condition cond );
 
+
+void ssl_init( void )
+{
+	initialized = TRUE;
+	SSLeay_add_ssl_algorithms();
+}
 
 void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
@@ -115,6 +121,5 @@
 	if( !initialized )
 	{
-		initialized = TRUE;
-		SSLeay_add_ssl_algorithms();
+		ssl_init();
 	}
 	
