changeset 7095:c8bf2da398e3

[gaim-migrate @ 7660] html.[ch] is gone. Everything inside was namespaced and put in util.[ch]. One less ugly part of gaim in the tree. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 01 Oct 2003 03:43:18 +0000
parents 2343c3aa1dec
children d88d79507276
files src/Makefile.am src/gtkconv.c src/gtkprefs.c src/protocols/jabber/jabber.c src/protocols/jabber/message.c src/protocols/jabber/presence.c src/protocols/msn/msn.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/yahoo/yahoo.c src/util.c src/util.h
diffstat 12 files changed, 613 insertions(+), 126 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.am	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/Makefile.am	Wed Oct 01 03:43:18 2003 +0000
@@ -64,8 +64,6 @@
 	debug.h \
 	ft.c \
 	ft.h \
-	html.c \
-	html.h \
 	imgstore.c \
 	imgstore.h \
 	md5.c \
--- a/src/gtkconv.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/gtkconv.c	Wed Oct 01 03:43:18 2003 +0000
@@ -33,7 +33,6 @@
 #include <locale.h>
 
 #include "debug.h"
-#include "html.h"
 #include "imgstore.h"
 #include "log.h"
 #include "multi.h"
@@ -4388,7 +4387,7 @@
 		gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), buf2, 0, images);
 
 		if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) {
-			char *t1 = strip_html(buf);
+			char *t1 = gaim_markup_strip_html(buf);
 
 			conv->history = g_string_append(conv->history, t1);
 			conv->history = g_string_append(conv->history, "\n");
@@ -4406,7 +4405,7 @@
 			char nm[256];
 
 			if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html"))
-				t1 = strip_html(buf);
+				t1 = gaim_markup_strip_html(buf);
 			else
 				t1 = buf;
 
@@ -4544,8 +4543,8 @@
 		if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) {
 			char *t1, *t2;
 
-			t1 = strip_html(buf);
-			t2 = strip_html(new_message);
+			t1 = gaim_markup_strip_html(buf);
+			t2 = gaim_markup_strip_html(new_message);
 
 			conv->history = g_string_append(conv->history, t1);
 			conv->history = g_string_append(conv->history, t2);
@@ -4581,8 +4580,8 @@
 				strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm));
 
 			if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) {
-				t1 = strip_html(buf);
-				t2 = strip_html(with_font_tag);
+				t1 = gaim_markup_strip_html(buf);
+				t2 = gaim_markup_strip_html(with_font_tag);
 			}
 			else {
 				t1 = html_logize(buf);
--- a/src/gtkprefs.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/gtkprefs.c	Wed Oct 01 03:43:18 2003 +0000
@@ -24,7 +24,6 @@
 #include "gtkinternal.h"
 
 #include "debug.h"
-#include "html.h"
 #include "notify.h"
 #include "prefs.h"
 #include "proxy.h"
--- a/src/protocols/jabber/jabber.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Wed Oct 01 03:43:18 2003 +0000
@@ -34,13 +34,13 @@
 #include "account.h"
 #include "accountopt.h"
 #include "debug.h"
-#include "html.h"
 #include "message.h"
 #include "multi.h"
 #include "notify.h"
 #include "prpl.h"
 #include "request.h"
 #include "server.h"
+#include "util.h"
 
 #include "auth.h"
 #include "buddy.h"
@@ -777,7 +777,9 @@
 	} else if(jb && !GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) {
 		ret = g_strdup(jb->error_msg);
 	} else {
-		char *stripped = strip_html(jabber_buddy_get_status_msg(jb));
+		char *stripped;
+
+		stripped = gaim_markup_strip_html(jabber_buddy_get_status_msg(jb));
 
 		if(!stripped && b->uc & UC_UNAVAILABLE)
 			stripped = g_strdup(jabber_get_state_string(b->uc));
@@ -802,7 +804,7 @@
 		char *text = NULL;
 		if(jbr->status) {
 			char *stripped;
-			stripped = strip_html(jbr->status);
+			stripped = gaim_markup_strip_html(jbr->status);
 			text = g_markup_escape_text(stripped, -1);
 			g_free(stripped);
 		}
--- a/src/protocols/jabber/message.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/jabber/message.c	Wed Oct 01 03:43:18 2003 +0000
@@ -21,9 +21,9 @@
 #include "internal.h"
 
 #include "debug.h"
-#include "html.h"
 #include "notify.h"
 #include "server.h"
+#include "util.h"
 
 #include "buddy.h"
 #include "chat.h"
@@ -348,7 +348,7 @@
 
 	buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body>%s</body></html>", msg);
 
-	html_to_xhtml(buf, &xhtml, &plain);
+	gaim_markup_html_to_xhtml(buf, &xhtml, &plain);
 	g_free(buf);
 
 	jm->body = plain;
@@ -378,7 +378,7 @@
 	jm->type = JABBER_MESSAGE_CHAT;
 	jm->to = g_strdup_printf("%s@%s", chat->room, chat->server);
 
-	html_to_xhtml(message, NULL, &jm->body);
+	gaim_markup_html_to_xhtml(message, NULL, &jm->body);
 
 	jabber_message_send(jm);
 	jabber_message_free(jm);
--- a/src/protocols/jabber/presence.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/jabber/presence.c	Wed Oct 01 03:43:18 2003 +0000
@@ -21,10 +21,10 @@
 #include "internal.h"
 
 #include "debug.h"
-#include "html.h"
 #include "notify.h"
 #include "request.h"
 #include "server.h"
+#include "util.h"
 
 #include "buddy.h"
 #include "chat.h"
@@ -54,7 +54,7 @@
 	char *stripped = NULL;
 
 	if(msg) {
-		html_to_xhtml(msg, NULL, &stripped);
+		gaim_markup_html_to_xhtml(msg, NULL, &stripped);
 	} else {
 		stripped = g_strdup("");
 	}
--- a/src/protocols/msn/msn.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/msn/msn.c	Wed Oct 01 03:43:18 2003 +0000
@@ -30,7 +30,7 @@
 #include "state.h"
 #include "utils.h"
 #include "multi.h"
-#include "html.h"
+#include "util.h"
 
 #define BUDDY_ALIAS_MAXLEN 388
 
@@ -1236,7 +1236,7 @@
 	url_buffer = g_strdup(url_text);
 
 	/* If they have a homepage link, MSN masks it such that we need to
-	 * fetch the url out before strip_html() nukes it */
+	 * fetch the url out before gaim_markup_strip_html() nukes it */
 	if ((p = strstr(url_text,
 			"Take a look at my </font><A class=viewDesc title=\"")) != NULL)
 	{
@@ -1247,7 +1247,7 @@
 	}
 
 	/*
-	 * strip_html() doesn't strip out character entities like &nbsp;
+	 * gaim_markup_strip_html() doesn't strip out character entities like &nbsp;
 	 * and &#183;
 	 */
 	while ((p = strstr(url_buffer, "&nbsp;")) != NULL)
@@ -1278,34 +1278,37 @@
 	}
 
 	/* Nuke the html, it's easier than trying to parse the horrid stuff */
-	stripped = strip_html(url_buffer);
+	stripped = gaim_markup_strip_html(url_buffer);
 
 	/* Gonna re-use the memory we've already got for url_buffer */
 	strcpy(url_buffer, "<html><body>\n");
 
 	/* Extract their Name and put it in */
-	info_extract_field(stripped, url_buffer, "\tName", 0, "\t", '\n',
-					   "Undisclosed", _("Name"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer, "\tName", 0, "\t",
+								   '\n', "Undisclosed", _("Name"), 0, NULL);
 
 	/* Extract their Age and put it in */
-	info_extract_field(stripped, url_buffer, "\tAge", 0, "\t", '\n',
-					   "Undisclosed", _("Age"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer, "\tAge", 0, "\t",
+								   '\n', "Undisclosed", _("Age"), 0, NULL);
 
 	/* Extract their Gender and put it in */
-	info_extract_field(stripped, url_buffer, "\tGender", 6, "\t", '\n',
-					   "Undisclosed", _("Gender"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer, "\tGender", 6, "\t",
+								   '\n', "Undisclosed", _("Gender"), 0, NULL);
 
 	/* Extract their MaritalStatus and put it in */
-	info_extract_field(stripped, url_buffer, "\tMaritalStatus", 0, "\t", '\n',
-					   "Undisclosed", _("Marital Status"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer, "\tMaritalStatus",
+								   0, "\t", '\n', "Undisclosed",
+								   _("Marital Status"), 0, NULL);
 
 	/* Extract their Location and put it in */
-	info_extract_field(stripped, url_buffer, "\tLocation", 0, "\t", '\n',
-					   "Undisclosed", _("Location"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer, "\tLocation", 0,
+								   "\t", '\n', "Undisclosed", _("Location"),
+								   0, NULL);
 
 	/* Extract their Occupation and put it in */
-	info_extract_field(stripped, url_buffer, "\t Occupation", 6, "\t", '\n',
-					   "Undisclosed", _("Occupation"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer, "\t Occupation", 6,
+								   "\t", '\n', "Undisclosed", _("Occupation"),
+								   0, NULL);
 
 	/*
 	 * The fields, 'A Little About Me', 'Favorite Things', 'Hobbies
@@ -1316,102 +1319,99 @@
 	 */
 
 	/* Check if they have A Little About Me */
-	found = info_extract_field(stripped, url_buffer, "\tA Little About Me",
-							   1, "Favorite Things", '\n', NULL,
-							   _("A Little About Me"), 0, NULL);
+	found = gaim_markup_extract_info_field(stripped, url_buffer,
+			"\tA Little About Me", 1, "Favorite Things", '\n', NULL,
+			_("A Little About Me"), 0, NULL);
 
 	if (!found)
 	{
-		found = info_extract_field(stripped, url_buffer,
-								   "\tA Little About Me", 1,
-								   "Hobbies and Interests", '\n', NULL,
-								   _("A Little About Me"), 0, NULL);
+		found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"\tA Little About Me", 1, "Hobbies and Interests", '\n',
+				NULL, _("A Little About Me"), 0, NULL);
+	}
+
+	if (!found)
+	{
+		found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"\tA Little About Me", 1, "Favorite Quote", '\n', NULL,
+				_("A Little About Me"), 0, NULL);
 	}
 
 	if (!found)
 	{
-		found = info_extract_field(stripped, url_buffer,
-								   "\tA Little About Me", 1,
-								   "Favorite Quote", '\n', NULL,
-								   _("A Little About Me"), 0, NULL);
+		found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"\tA Little About Me", 1, "My Homepage\tTake a look", '\n',
+				NULL, _("A Little About Me"), 0, NULL);
 	}
 
 	if (!found)
 	{
-		found = info_extract_field(stripped, url_buffer,
-								   "\tA Little About Me", 1,
-								   "My Homepage\tTake a look", '\n', NULL,
-								   _("A Little About Me"), 0, NULL);
+		gaim_markup_extract_info_field(stripped, url_buffer,
+				"\tA Little About Me", 1, "last updated", '\n', NULL,
+				_("A Little About Me"), 0, NULL);
+	}
+
+	/* Check if they have Favorite Things */
+	found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"Favorite Things", 1, "Hobbies and Interests", '\n', NULL,
+				_("Favorite Things"), 0, NULL);
+
+	if (!found)
+	{
+		found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"Favorite Things", 1, "Favorite Quote", '\n', NULL,
+				"Favorite Things", 0, NULL);
 	}
 
 	if (!found)
 	{
-		info_extract_field(stripped, url_buffer, "\tA Little About Me", 1,
-						   "last updated", '\n',
-							NULL, _("A Little About Me"), 0, NULL);
-	}
-
-	/* Check if they have Favorite Things */
-	found = info_extract_field(stripped, url_buffer, "Favorite Things", 1,
-							   "Hobbies and Interests", '\n', NULL,
-							   _("Favorite Things"), 0, NULL);
-
-	if (!found)
-	{
-		found = info_extract_field(stripped, url_buffer, "Favorite Things", 1,
-								   "Favorite Quote", '\n', NULL,
-								   "Favorite Things", 0, NULL);
-	}
-
-	if (!found)
-	{
-		found = info_extract_field(stripped, url_buffer, "Favorite Things", 1,
-								   "My Homepage\tTake a look", '\n', NULL,
-								   _("Favorite Things"), 0, NULL);
+		found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"Favorite Things", 1, "My Homepage\tTake a look", '\n', NULL,
+				_("Favorite Things"), 0, NULL);
 	}
 
 	if (!found)
 	{
-		info_extract_field(stripped, url_buffer, "Favorite Things", 1,
-						   "last updated", '\n', NULL,
-						   _("Favorite Things"), 0, NULL);
+		gaim_markup_extract_info_field(stripped, url_buffer,
+				"Favorite Things", 1, "last updated", '\n', NULL,
+				_("Favorite Things"), 0, NULL);
 	}
 
 	/* Check if they have Hobbies and Interests */
-	found = info_extract_field(stripped, url_buffer, "Hobbies and Interests",
-							   1, "Favorite Quote", '\n', NULL,
-							   _("Hobbies and Interests"), 0, NULL);
+	found = gaim_markup_extract_info_field(stripped, url_buffer,
+			"Hobbies and Interests", 1, "Favorite Quote", '\n', NULL,
+			_("Hobbies and Interests"), 0, NULL);
 
 	if (!found)
 	{
-		found = info_extract_field(stripped, url_buffer,
-								   "Hobbies and Interests", 1,
-								   "My Homepage\tTake a look", '\n', NULL,
-								   _("Hobbies and Interests"), 0, NULL);
+		found = gaim_markup_extract_info_field(stripped, url_buffer,
+				"Hobbies and Interests", 1, "My Homepage\tTake a look",
+				'\n', NULL, _("Hobbies and Interests"), 0, NULL);
 	}
 
 	if (!found)
 	{
-		info_extract_field(stripped, url_buffer, "Hobbies and Interests",
-						   1, "last updated", '\n', NULL,
-						   _("Hobbies and Interests"), 0, NULL);
+		gaim_markup_extract_info_field(stripped, url_buffer,
+				"Hobbies and Interests", 1, "last updated", '\n', NULL,
+				_("Hobbies and Interests"), 0, NULL);
 	}
 
 	/* Check if they have Favorite Quote */
-	found = info_extract_field(stripped, url_buffer, "Favorite Quote", 1,
-							   "My Homepage\tTake a look", '\n', NULL,
-							   _("Favorite Quote"), 0, NULL);
+	found = gaim_markup_extract_info_field(stripped, url_buffer,
+			"Favorite Quote", 1, "My Homepage\tTake a look", '\n', NULL,
+			_("Favorite Quote"), 0, NULL);
 
 	if (!found)
 	{
-		info_extract_field(stripped, url_buffer, "Favorite Quote", 1,
-						   "last updated", '\n', NULL,
-						   _("Favorite Quote"), 0, NULL);
+		gaim_markup_extract_info_field(stripped, url_buffer,
+				"Favorite Quote", 1, "last updated", '\n', NULL,
+				_("Favorite Quote"), 0, NULL);
 	}
 
 	/* Extract the last updated date and put it in */
-	info_extract_field(stripped, url_buffer, "\tlast updated:", 1, "\n", '\n',
-					   NULL, _("Last Updated"), 0, NULL);
+	gaim_markup_extract_info_field(stripped, url_buffer,
+			"\tlast updated:", 1, "\n", '\n', NULL, _("Last Updated"),
+			0, NULL);
 
 	/* If we were able to fetch a homepage url earlier, stick it in there */
 	if (user_url != NULL)
--- a/src/protocols/oscar/oscar.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Oct 01 03:43:18 2003 +0000
@@ -41,7 +41,6 @@
 #include "proxy.h"
 #include "request.h"
 #include "util.h"
-#include "html.h"
 
 #include "aim.h"
 #include "md5.h"
@@ -5279,7 +5278,7 @@
 	if (strlen(buf) > c->maxlen)
 		return -E2BIG;
 
-	buf2 = strip_html(buf);
+	buf2 = gaim_markup_strip_html(buf);
 	if (strlen(buf2) > c->maxvis) {
 		g_free(buf2);
 		return -E2BIG;
@@ -5418,7 +5417,7 @@
 			if (away_utf8 != NULL) {
 				gchar *tmp1, *tmp2;
 				tmp1 = gaim_strreplace(away_utf8, "<BR>", "\n");
-				tmp2 = strip_html(tmp1);
+				tmp2 = gaim_markup_strip_html(tmp1);
 				g_free(tmp1);
 				tmp1 = away_subs(tmp2, gaim_connection_get_display_name(gc));
 				g_free(tmp2);
--- a/src/protocols/toc/toc.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/toc/toc.c	Wed Oct 01 03:43:18 2003 +0000
@@ -30,7 +30,6 @@
 #include "proxy.h"
 #include "request.h"
 #include "util.h"
-#include "html.h"
 
 static GaimPlugin *my_protocol = NULL;
 
--- a/src/protocols/yahoo/yahoo.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Wed Oct 01 03:43:18 2003 +0000
@@ -33,7 +33,6 @@
 #include "request.h"
 #include "server.h"
 #include "util.h"
-#include "html.h"
 
 #include "sha.h"
 #include "yahoo.h"
@@ -1919,7 +1918,7 @@
 	case YAHOO_STATUS_CUSTOM:
 		if (!f->msg)
 			return NULL;
-		stripped = strip_html(f->msg);
+		stripped = gaim_markup_strip_html(f->msg);
 		if (stripped) {
  			char *ret = g_markup_escape_text(stripped, strlen(stripped));
  			g_free(stripped);
@@ -1953,7 +1952,7 @@
 		case YAHOO_STATUS_CUSTOM:
 			if (!f->msg)
 				return NULL;
-			status = strip_html(f->msg);
+			status = gaim_markup_strip_html(f->msg);
 			break;
 		default:
 			status = g_strdup(yahoo_get_status_string(f->status));
@@ -2411,7 +2410,7 @@
 	p = strstr(url_text, "Adult Profiles Warning Message");
 	if (p) {
 		strcpy(buf, _("<b>Sorry, profiles marked as containing adult content are not supported at this time.</b><br><br>\n"));
-		info_extract_field(url_text, buf, ".idname=", 0, "%26", 0, NULL,
+		gaim_markup_extract_info_field(url_text, buf, ".idname=", 0, "%26", 0, NULL,
 				_("If you wish to view this profile, you will need to visit this link in your web browser"),
 				1, YAHOO_PROFILE_URL);
 		strcat(buf, "</body></html>\n");
@@ -2428,7 +2427,7 @@
 	p = strstr(url_text, "Last Updated:");
 	if (!p) {
 		strcpy(buf, _("<b>Sorry, non-English profiles are not supported at this time.</b><br><br>\n"));
-		info_extract_field(url_text, buf, "<title>", 0, "'s Yahoo! Profile", 0, NULL,
+		gaim_markup_extract_info_field(url_text, buf, "<title>", 0, "'s Yahoo! Profile", 0, NULL,
 				_("If you wish to view this profile, you will need to visit this link in your web browser"),
 				1, YAHOO_PROFILE_URL);
 		strcat(buf, "</body></html>\n");
@@ -2439,7 +2438,7 @@
 
 	url_buffer = g_strdup(url_text);
 
-	/* strip_html() doesn't strip out character entities like &nbsp; and &#183;
+	/* gaim_markup_strip_html() doesn't strip out character entities like &nbsp; and &#183;
 	*/
 	while ((p = strstr(url_buffer, "&nbsp;")) != NULL) {
 		memmove(p, p + 6, strlen(p + 6));
@@ -2457,45 +2456,45 @@
 	}
 
 	/* nuke the html, it's easier than trying to parse the horrid stuff */
-	stripped = strip_html(url_buffer);
+	stripped = gaim_markup_strip_html(url_buffer);
 
 	/* gonna re-use the memory we've already got for url_buffer */
 	strcpy(url_buffer, "<html><body>\n");
 
 	/* extract their Yahoo! ID and put it in */
-	info_extract_field(stripped, url_buffer, "Yahoo! ID:", 2, "\n", 0,
+	gaim_markup_extract_info_field(stripped, url_buffer, "Yahoo! ID:", 2, "\n", 0,
 			NULL, _("Yahoo! ID"), 0, NULL);
 
 	/* extract their Email address and put it in */
-	info_extract_field(stripped, url_buffer, "My Email", 5, "\n", 0,
+	gaim_markup_extract_info_field(stripped, url_buffer, "My Email", 5, "\n", 0,
 			"Private", _("Email"), 0, NULL);
 
 	/* extract the Nickname if it exists */
-	info_extract_field(stripped, url_buffer, "Nickname:", 1, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "Nickname:", 1, "\n", '\n',
 			NULL, _("Nickname"), 0, NULL);
 
 	/* extract their RealName and put it in */
-	info_extract_field(stripped, url_buffer, "RealName:", 1, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "RealName:", 1, "\n", '\n',
 			NULL, _("Realname"), 0, NULL);
 
 	/* extract their Location and put it in */
-	info_extract_field(stripped, url_buffer, "Location:", 2, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "Location:", 2, "\n", '\n',
 			NULL, _("Location"), 0, NULL);
 
 	/* extract their Age and put it in */
-	info_extract_field(stripped, url_buffer, "Age:", 3, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "Age:", 3, "\n", '\n',
 			NULL, _("Age"), 0, NULL);
 
 	/* extract their MaritalStatus and put it in */
-	info_extract_field(stripped, url_buffer, "MaritalStatus:", 3, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "MaritalStatus:", 3, "\n", '\n',
 			"No Answer", _("Marital Status"), 0, NULL);
 
 	/* extract their Gender and put it in */
-	info_extract_field(stripped, url_buffer, "Gender:", 3, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "Gender:", 3, "\n", '\n',
 			"No Answer", _("Gender"), 0, NULL);
 
 	/* extract their Occupation and put it in */
-	info_extract_field(stripped, url_buffer, "Occupation:", 2, "\n", '\n',
+	gaim_markup_extract_info_field(stripped, url_buffer, "Occupation:", 2, "\n", '\n',
 			NULL, _("Occupation"), 0, NULL);
 
 	/* Hobbies, Latest News, and Favorite Quote are a bit different, since the
@@ -2505,24 +2504,24 @@
 	 * looking for the 'Links' heading, which is the next thing to follow this
 	 * bunch.
 	 */
-	if (!info_extract_field(stripped, url_buffer, "Hobbies:", 1, "Latest News",
+	if (!gaim_markup_extract_info_field(stripped, url_buffer, "Hobbies:", 1, "Latest News",
 				'\n', NULL, _("Hobbies"), 0, NULL))
-		if (!info_extract_field(stripped, url_buffer, "Hobbies:", 1, "Favorite Quote",
+		if (!gaim_markup_extract_info_field(stripped, url_buffer, "Hobbies:", 1, "Favorite Quote",
 					'\n', NULL, _("Hobbies"), 0, NULL))
-			info_extract_field(stripped, url_buffer, "Hobbies:", 1, "Links",
+			gaim_markup_extract_info_field(stripped, url_buffer, "Hobbies:", 1, "Links",
 					'\n', NULL, _("Hobbies"), 0, NULL);
-	if (!info_extract_field(stripped, url_buffer, "Latest News:", 1, "Favorite Quote",
+	if (!gaim_markup_extract_info_field(stripped, url_buffer, "Latest News:", 1, "Favorite Quote",
 				'\n', NULL, _("Latest News"), 0, NULL))
-		info_extract_field(stripped, url_buffer, "Latest News:", 1, "Links",
+		gaim_markup_extract_info_field(stripped, url_buffer, "Latest News:", 1, "Links",
 				'\n', NULL, _("Latest News"), 0, NULL);
-	info_extract_field(stripped, url_buffer, "Favorite Quote:", 0, "Links",
+	gaim_markup_extract_info_field(stripped, url_buffer, "Favorite Quote:", 0, "Links",
 			'\n', NULL, _("Favorite Quote"), 0, NULL);
 
 	/* Home Page will either be "No home page specified",
 	 * or "Home Page: " and a link. */
 	p = strstr(stripped, "No home page specified");
 	if (!p)
-		info_extract_field(stripped, url_buffer, "Home Page:", 1, " ", 0, NULL,
+		gaim_markup_extract_info_field(stripped, url_buffer, "Home Page:", 1, " ", 0, NULL,
 				_("Home Page"), 1, NULL);
 
 	/* Cool Link {1,2,3} is also different.  If "No cool link specified" exists,
@@ -2532,19 +2531,19 @@
 	 */
 	p = strstr(stripped,"No cool link specified");
 	if (!p)
-		if (info_extract_field(stripped, url_buffer, "Cool Link 1:", 1, " ", 0, NULL,
+		if (gaim_markup_extract_info_field(stripped, url_buffer, "Cool Link 1:", 1, " ", 0, NULL,
 					_("Cool Link 1"), 1, NULL))
-			if (info_extract_field(stripped, url_buffer, "Cool Link 2:", 1, " ", 0, NULL,
+			if (gaim_markup_extract_info_field(stripped, url_buffer, "Cool Link 2:", 1, " ", 0, NULL,
 						_("Cool Link 2"), 1, NULL))
-				info_extract_field(stripped, url_buffer, "Cool Link 3:", 1, " ", 0, NULL,
+				gaim_markup_extract_info_field(stripped, url_buffer, "Cool Link 3:", 1, " ", 0, NULL,
 						_("Cool Link 3"), 1, NULL);
 
 	/* see if Member Since is there, and if so, extract it. */
-	info_extract_field(stripped, url_buffer, "Member Since:", 1, "Last Updated:",
+	gaim_markup_extract_info_field(stripped, url_buffer, "Member Since:", 1, "Last Updated:",
 			'\n', NULL, _("Member Since"), 0, NULL);
 
 	/* extract the Last Updated date and put it in */
-	info_extract_field(stripped, url_buffer, "Last Updated:", 1, "\n", '\n', NULL,
+	gaim_markup_extract_info_field(stripped, url_buffer, "Last Updated:", 1, "\n", '\n', NULL,
 			_("Last Updated"), 0, NULL);
 
 	/* finish off the html */
--- a/src/util.c	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/util.c	Wed Oct 01 03:43:18 2003 +0000
@@ -2,8 +2,9 @@
  * @file util.h Utility Functions
  * @ingroup core
  *
- * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
- * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * Copyright (C) 1998-1999 Mark Spencer <markster@marko.net>
+ *               2003 Christian Hammond <chipx86@gnupdate.org>
+ *               2003 Nathan Walp <faceprint@faceprint.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1169,6 +1170,448 @@
 }
 
 gboolean
+gaim_markup_extract_info_field(const char *str, char *dest_buffer,
+							   const char *start_token, int skip,
+							   const char *end_token, char check_value,
+							   const char *no_value_token,
+							   const char *display_name, gboolean is_link,
+							   const char *link_prefix)
+{
+	const char *p, *q;
+	char buf[1024];
+
+	g_return_val_if_fail(str          != NULL, FALSE);
+	g_return_val_if_fail(dest_buffer  != NULL, FALSE);
+	g_return_val_if_fail(start_token  != NULL, FALSE);
+	g_return_val_if_fail(end_token    != NULL, FALSE);
+	g_return_val_if_fail(display_name != NULL, FALSE);
+
+	p = strstr(str, start_token);
+
+	if (p == NULL)
+		return FALSE;
+
+	p += strlen(start_token) + skip;
+
+	if (check_value != '\0' && *p == check_value)
+		return FALSE;
+
+	q = strstr(p, end_token);
+
+	if (q != NULL && (!no_value_token ||
+					  (no_value_token && strncmp(p, no_value_token,
+												 strlen(no_value_token)))))
+	{
+		strcat(dest_buffer, "<b>");
+		strcat(dest_buffer, display_name);
+		strcat(dest_buffer, ":</b> ");
+
+		if (is_link)
+		{
+			strcat(dest_buffer, "<br><a href=\"");
+			memcpy(buf, p, q - p);
+			buf[q - p] = '\0';
+
+			if (link_prefix)
+				strcat(dest_buffer, link_prefix);
+
+			strcat(dest_buffer, buf);
+			strcat(dest_buffer, "\">");
+
+			if (link_prefix)
+				strcat(dest_buffer, link_prefix);
+
+			strcat(dest_buffer, buf);
+			strcat(dest_buffer, "</a>");
+		}
+		else
+		{
+			memcpy(buf, p, q - p);
+			buf[q - p] = '\0';
+			strcat(dest_buffer, buf);
+		}
+
+		strcat(dest_buffer, "<br>\n");
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+struct gaim_parse_tag {
+	char *src_tag;
+	char *dest_tag;
+};
+
+#define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \
+						const char *o = c + strlen("<" x); \
+						const char *p = NULL, *q = NULL, *r = NULL; \
+						GString *innards = g_string_new(""); \
+						while(o && *o) { \
+							if(!q && (*o == '\"' || *o == '\'') ) { \
+								q = o; \
+							} else if(q) { \
+								if(*o == *q) { \
+									char *unescaped = g_strndup(q+1, o-q-1); \
+									char *escaped = g_markup_escape_text(unescaped, -1); \
+									g_string_append_printf(innards, "%c%s%c", *q, escaped, *q); \
+									g_free(unescaped); \
+									g_free(escaped); \
+									q = NULL; \
+								} else if(*c == '\\') { \
+									o++; \
+								} \
+							} else if(*o == '<') { \
+								r = o; \
+							} else if(*o == '>') { \
+								p = o; \
+								break; \
+							} else { \
+								innards = g_string_append_c(innards, *o); \
+							} \
+							o++; \
+						} \
+						if(p && !r) { \
+							if(*(p-1) != '/') { \
+								struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1); \
+								pt->src_tag = x; \
+								pt->dest_tag = y; \
+								tags = g_list_prepend(tags, pt); \
+							} \
+							xhtml = g_string_append(xhtml, "<" y); \
+							c += strlen("<" x ); \
+							xhtml = g_string_append(xhtml, innards->str); \
+							xhtml = g_string_append_c(xhtml, '>'); \
+							c = p + 1; \
+						} else { \
+							xhtml = g_string_append(xhtml, "&lt;"); \
+							plain = g_string_append_c(plain, '<'); \
+							c++; \
+						} \
+						g_string_free(innards, TRUE); \
+						continue; \
+					} \
+						if(!g_ascii_strncasecmp(c, "<" x, strlen("<" x)) && \
+								(*(c+strlen("<" x)) == '>' || \
+								 !g_ascii_strncasecmp(c+strlen("<" x), "/>", 2))) { \
+							xhtml = g_string_append(xhtml, "<" y); \
+							c += strlen("<" x); \
+							if(*c != '/') { \
+								struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1); \
+								pt->src_tag = x; \
+								pt->dest_tag = y; \
+								tags = g_list_prepend(tags, pt); \
+								xhtml = g_string_append_c(xhtml, '>'); \
+							} else { \
+								xhtml = g_string_append(xhtml, "/>");\
+							} \
+							c = strchr(c, '>') + 1; \
+							continue; \
+						}
+#define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x)
+void
+gaim_markup_html_to_xhtml(const char *html, char **xhtml_out,
+						  char **plain_out)
+{
+	GString *xhtml = g_string_new("");
+	GString *plain = g_string_new("");
+	GList *tags = NULL, *tag;
+	const char *c = html;
+
+	while(c && *c) {
+		if(*c == '<') {
+			if(*(c+1) == '/') { /* closing tag */
+				tag = tags;
+				while(tag) {
+					struct gaim_parse_tag *pt = tag->data;
+					if(!g_ascii_strncasecmp((c+2), pt->src_tag, strlen(pt->src_tag)) && *(c+strlen(pt->src_tag)+2) == '>') {
+						c += strlen(pt->src_tag) + 3;
+						break;
+					}
+					tag = tag->next;
+				}
+				if(tag) {
+					while(tags) {
+						struct gaim_parse_tag *pt = tags->data;
+						g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
+						if(tags == tag)
+							break;
+						tags = g_list_remove(tags, pt);
+						g_free(pt);
+					}
+					g_free(tag->data);
+					tags = g_list_remove(tags, tag->data);
+				} else {
+					/* we tried to close a tag we never opened! escape it
+					 * and move on */
+					xhtml = g_string_append(xhtml, "&lt;");
+					plain = g_string_append_c(plain, '<');
+					c++;
+				}
+			} else { /* opening tag */
+				ALLOW_TAG("a");
+				ALLOW_TAG_ALT("b", "strong");
+				ALLOW_TAG("blockquote");
+				ALLOW_TAG_ALT("bold", "strong");
+				ALLOW_TAG("cite");
+				ALLOW_TAG("div");
+				ALLOW_TAG("em");
+				ALLOW_TAG("h1");
+				ALLOW_TAG("h2");
+				ALLOW_TAG("h3");
+				ALLOW_TAG("h4");
+				ALLOW_TAG("h5");
+				ALLOW_TAG("h6");
+				/* we only allow html to start the message */
+				if(c == html)
+					ALLOW_TAG("html");
+				ALLOW_TAG_ALT("i", "em");
+				ALLOW_TAG_ALT("italic", "em");
+				ALLOW_TAG("li");
+				ALLOW_TAG("ol");
+				ALLOW_TAG("p");
+				ALLOW_TAG("pre");
+				ALLOW_TAG("q");
+				ALLOW_TAG("span");
+				ALLOW_TAG("strong");
+				ALLOW_TAG("ul");
+
+				/* we skip <HR> because it's not legal in XHTML-IM.  However,
+				 * we still want to send something sensible, so we put a
+				 * linebreak in its place. <BR> also needs special handling
+				 * because putting a </BR> to close it would just be dumb. */
+				if((!g_ascii_strncasecmp(c, "<br", 3)
+							|| !g_ascii_strncasecmp(c, "<hr", 3))
+						&& (*(c+3) == '>' ||
+							!g_ascii_strncasecmp(c+3, "/>", 2) ||
+							!g_ascii_strncasecmp(c+3, " />", 3))) {
+					c = strchr(c, '>') + 1;
+					xhtml = g_string_append(xhtml, "<br/>");
+					if(*c != '\n')
+						plain = g_string_append_c(plain, '\n');
+					continue;
+				}
+				if(!g_ascii_strncasecmp(c, "<u>", 3) || !g_ascii_strncasecmp(c, "<underline>", strlen("<underline>"))) {
+					struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1);
+					pt->src_tag = *(c+2) == '>' ? "u" : "underline";
+					pt->dest_tag = "span";
+					tags = g_list_prepend(tags, pt);
+					c = strchr(c, '>') + 1;
+					xhtml = g_string_append(xhtml, "<span style='text-decoration: underline;'>");
+					continue;
+				}
+				if(!g_ascii_strncasecmp(c, "<s>", 3) || !g_ascii_strncasecmp(c, "<strike>", strlen("<strike>"))) {
+					struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1);
+					pt->src_tag = *(c+2) == '>' ? "s" : "strike";
+					pt->dest_tag = "span";
+					tags = g_list_prepend(tags, pt);
+					c = strchr(c, '>') + 1;
+					xhtml = g_string_append(xhtml, "<span style='text-decoration: line-through;'>");
+					continue;
+				}
+				if(!g_ascii_strncasecmp(c, "<sub>", 5)) {
+					struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1);
+					pt->src_tag = "sub";
+					pt->dest_tag = "span";
+					tags = g_list_prepend(tags, pt);
+					c = strchr(c, '>') + 1;
+					xhtml = g_string_append(xhtml, "<span style='vertical-align:sub;'>");
+					continue;
+				}
+				if(!g_ascii_strncasecmp(c, "<sup>", 5)) {
+					struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1);
+					pt->src_tag = "sup";
+					pt->dest_tag = "span";
+					tags = g_list_prepend(tags, pt);
+					c = strchr(c, '>') + 1;
+					xhtml = g_string_append(xhtml, "<span style='vertical-align:super;'>");
+					continue;
+				}
+				if(!g_ascii_strncasecmp(c, "<font", 5) && (*(c+5) == '>' || *(c+5) == ' ')) {
+					const char *p = c;
+					GString *style = g_string_new("");
+					struct gaim_parse_tag *pt;
+					while(*p && *p != '>') {
+						if(!g_ascii_strncasecmp(p, "color=", strlen("color="))) {
+							const char *q = p + strlen("color=");
+							GString *color = g_string_new("");
+							if(*q == '\'' || *q == '\"')
+								q++;
+							while(*q && *q != '\"' && *q != '\'' && *q != ' ') {
+								color = g_string_append_c(color, *q);
+								q++;
+							}
+							g_string_append_printf(style, "color: %s; ", color->str);
+							g_string_free(color, TRUE);
+							p = q;
+						} else if(!g_ascii_strncasecmp(p, "face=", strlen("face="))) {
+							const char *q = p + strlen("face=");
+							gboolean space_allowed = FALSE;
+							GString *face = g_string_new("");
+							if(*q == '\'' || *q == '\"') {
+								space_allowed = TRUE;
+								q++;
+							}
+							while(*q && *q != '\"' && *q != '\'' && (space_allowed || *q != ' ')) {
+								face = g_string_append_c(face, *q);
+								q++;
+							}
+							g_string_append_printf(style, "font-family: %s; ", face->str);
+							g_string_free(face, TRUE);
+							p = q;
+						} else if(!g_ascii_strncasecmp(p, "size=", strlen("size="))) {
+							const char *q = p + strlen("size=");
+							int sz;
+							const char *size = "medium";
+							if(*q == '\'' || *q == '\"')
+								q++;
+							sz = atoi(q);
+							if(sz < 3)
+								size = "smaller";
+							else if(sz > 3)
+								size = "larger";
+							g_string_append_printf(style, "font-size: %s; ", size);
+							p = q;
+						}
+						p++;
+					}
+					c = strchr(c, '>') + 1;
+					pt = g_new0(struct gaim_parse_tag, 1);
+					pt->src_tag = "font";
+					pt->dest_tag = "span";
+					tags = g_list_prepend(tags, pt);
+					xhtml = g_string_append(xhtml, "<span");
+					if(style->len)
+						g_string_append_printf(xhtml, " style='%s'", style->str);
+					xhtml = g_string_append_c(xhtml, '>');
+					g_string_free(style, TRUE);
+					continue;
+				}
+				if(!g_ascii_strncasecmp(c, "<body ", 6)) {
+					const char *p = c;
+					gboolean did_something = FALSE;
+					while(*p && *p != '>') {
+						if(!g_ascii_strncasecmp(p, "bgcolor=", strlen("bgcolor="))) {
+							const char *q = p + strlen("bgcolor=");
+							struct gaim_parse_tag *pt = g_new0(struct gaim_parse_tag, 1);
+							GString *color = g_string_new("");
+							if(*q == '\'' || *q == '\"')
+								q++;
+							while(*q && *q != '\"' && *q != '\'' && *q != ' ') {
+								color = g_string_append_c(color, *q);
+								q++;
+							}
+							g_string_append_printf(xhtml, "<span style='background: %s;'>", color->str);
+							g_string_free(color, TRUE);
+							c = strchr(c, '>') + 1;
+							pt->src_tag = "body";
+							pt->dest_tag = "span";
+							tags = g_list_prepend(tags, pt);
+							did_something = TRUE;
+							break;
+						}
+						p++;
+					}
+					if(did_something) continue;
+				}
+				/* this has to come after the special case for bgcolor */
+				ALLOW_TAG("body");
+				if(!g_ascii_strncasecmp(c, "<!--", strlen("<!--"))) {
+					char *p = strstr(c + strlen("<!--"), "-->");
+					if(p) {
+						xhtml = g_string_append(xhtml, "<!--");
+						c += strlen("<!--");
+						continue;
+					}
+				}
+
+				xhtml = g_string_append(xhtml, "&lt;");
+				plain = g_string_append_c(plain, '<');
+				c++;
+			}
+		} else {
+			xhtml = g_string_append_c(xhtml, *c);
+			plain = g_string_append_c(plain, *c);
+			c++;
+		}
+	}
+	tag = tags;
+	while(tag) {
+		g_string_append_printf(xhtml, "</%s>", (char *)tag->data);
+		tag = tag->next;
+	}
+	g_list_free(tags);
+	if(xhtml_out)
+		*xhtml_out = g_strdup(xhtml->str);
+	if(plain_out)
+		*plain_out = g_strdup(plain->str);
+	g_string_free(xhtml, TRUE);
+	g_string_free(plain, TRUE);
+}
+
+char *
+gaim_markup_strip_html(const char *str)
+{
+	int i, j, k;
+	gboolean visible = TRUE;
+	gchar *str2;
+
+	g_return_val_if_fail(str != NULL, NULL);
+
+	str2 = g_strdup(str);
+
+	for (i = 0, j = 0; str2[i]; i++)
+	{
+		if (str2[i] == '<')
+		{
+			k = i + 1;
+
+			if(g_ascii_isspace(str2[k]))
+				visible = TRUE;
+			else
+			{
+				while (str2[k])
+				{
+					if (str2[k] == '<')
+					{
+						visible = TRUE;
+						break;
+					}
+
+					if (str2[k] == '>')
+					{
+						visible = FALSE;
+						break;
+					}
+
+					k++;
+				}
+			}
+		}
+		else if (str2[i] == '>' && !visible)
+		{
+			visible = TRUE;
+			continue;
+		}
+
+		if (str2[i] == '&' && strncasecmp(str2 + i, "&quot;", 6) == 0)
+		{
+		    str2[j++] = '\"';
+		    i = i + 5;
+		    continue;
+		}
+
+		if (visible)
+			str2[j++] = str2[i];
+	}
+
+	str2[j] = '\0';
+
+	return str2;
+}
+
+gboolean
 gaim_url_parse(const char *url, char **ret_host, int *ret_port,
 			   char **ret_path)
 {
--- a/src/util.h	Wed Oct 01 03:01:25 2003 +0000
+++ b/src/util.h	Wed Oct 01 03:43:18 2003 +0000
@@ -350,6 +350,55 @@
 							  GData **attributes);
 
 /**
+ * Extracts a field of data from HTML.
+ *
+ * This is a scary function. See protocols/msn/msn.c and
+ * protocols/yahoo/yahoo.c for example usage.
+ *
+ * @param str            The string to parse.
+ * @param dest_buffer    The destination buffer to append the new
+ *                       field info to.
+ * @param start_token    The beginning token.
+ * @param skip           The number of characters to skip after the
+ *                       start token.
+ * @param end_token      The ending token.
+ * @param check_value    The value that the last character must meet.
+ * @param no_value_token The token indicating no value is given.
+ * @param display_name   The short descriptive name to display for this token.
+ * @param is_link        TRUE if this should be a link, or FALSE otherwise.
+ * @param link_prefix    The prefix for the link.
+ *
+ * @return TRUE if successful, or FALSE otherwise.
+ */
+gboolean gaim_markup_extract_info_field(const char *str, char *dest_buffer,
+										const char *start_token, int skip,
+										const char *end_token,
+										char check_value,
+										const char *no_value_token,
+										const char *display_name,
+										gboolean is_link,
+										const char *link_prefix);
+
+/**
+ * Converts HTML markup to XHTML.
+ *
+ * @param html       The HTML markup.
+ * @param dest_xhtml The destination XHTML output.
+ * @param dest_plain The destination plain-text output.
+ */
+void gaim_markup_html_to_xhtml(const char *html, char **dest_xhtml,
+							   char **dest_plain);
+
+/**
+ * Strips HTML tags from a string.
+ *
+ * @param str The string to strip HTML from.
+ *
+ * @return The new string without HTML. This must be freed.
+ */
+char *gaim_markup_strip_html(const char *str);
+
+/**
  * Parses a URL, returning its host, port, and file path.
  *
  * The returned data must be freed.