changeset 8530:45e8c6cbd4a5

[gaim-migrate @ 9269] Removes formatting support for MSN. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 31 Mar 2004 02:27:30 +0000
parents 2f505651ac03
children fc7ba96fd76f
files src/protocols/msn/msn.c src/protocols/msn/utils.c src/protocols/msn/utils.h
diffstat 3 files changed, 3 insertions(+), 143 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Tue Mar 30 17:44:40 2004 +0000
+++ b/src/protocols/msn/msn.c	Wed Mar 31 02:27:30 2004 +0000
@@ -487,7 +487,6 @@
 		msn_http_session_init(session);
 
 	gc->proto_data = session;
-	gc->flags |= GAIM_CONNECTION_HTML;
 
 	gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS);
 
@@ -533,19 +532,17 @@
 	if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) {
 		MsnMessage *msg;
 		MsnUser *user;
-		char *msgformat;
+		/*char *msgformat;*/
 		char *msgtext;
 
 		user = msn_user_new(session, who, NULL);
 
-		msn_import_html(message, &msgformat, &msgtext);
-
 		msg = msn_message_new();
 		msn_message_set_receiver(msg, user);
-		msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
+		/*msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);*/
 		msn_message_set_body(msg, msgtext);
 
-		g_free(msgformat);
+		/*g_free(msgformat);*/
 		g_free(msgtext);
 
 		if (swboard != NULL) {
--- a/src/protocols/msn/utils.c	Tue Mar 30 17:44:40 2004 +0000
+++ b/src/protocols/msn/utils.c	Wed Mar 31 02:27:30 2004 +0000
@@ -150,129 +150,3 @@
 	return buf;
 }
 
-/*
- * Taken from the zephyr plugin.
- * This parses HTML formatting (put out by one of the gtkimhtml widgets
- * and converts it to msn formatting. It doesn't deal with the tag closing,
- * but gtkimhtml widgets give valid html.
- * It currently deals properly with <b>, <u>, <i>, <font face=...>,
- * <font color=...>.
- * It ignores <font back=...> and <font size=...>
- */
-void
-msn_import_html(const char *html, char **attributes, char **message)
-{
-	int len, retcount = 0;
-	const char *c;
-	char *msg;
-	char *fontface = NULL;
-	char fonteffect[4];
-	char fontcolor[7];
-
-	g_return_if_fail(html       != NULL);
-	g_return_if_fail(attributes != NULL);
-	g_return_if_fail(message    != NULL);
-
-	len = strlen(html);
-	msg = g_malloc0(len + 1);
-
-	memset(fontcolor, 0, sizeof(fontcolor));
-	memset(fonteffect, 0, sizeof(fontcolor));
-
-	for (c = html; *c != '\0';)
-	{
-		if (*c == '<')
-		{
-			if (!g_ascii_strncasecmp(c + 1, "i>", 2))
-			{
-				strcat(fonteffect, "I");
-				c += 3;
-			}
-			else if (!g_ascii_strncasecmp(c + 1, "b>", 2))
-			{
-				strcat(fonteffect, "B");
-				c += 3;
-			}
-			else if (!g_ascii_strncasecmp(c + 1, "u>", 2))
-			{
-				strcat(fonteffect, "U");
-				c += 3;
-			}
-			else if (!g_ascii_strncasecmp(c + 1, "a href=\"", 8))
-			{
-				c += 9;
-
-				while (g_ascii_strncasecmp(c, "\">", 2))
-					msg[retcount++] = *c++;
-
-				c += 2;
-
-				/* ignore descriptive string */
-				while (g_ascii_strncasecmp(c, "</a>", 4))
-					c++;
-
-				c += 4;
-			}
-			else if (!g_ascii_strncasecmp(c + 1, "font", 4))
-			{
-				c += 5;
-
-				while (!g_ascii_strncasecmp(c, " ", 1))
-					c++;
-
-				if (!g_ascii_strncasecmp(c, "color=\"#", 7))
-				{
-					c += 8;
-
-					fontcolor[0] = *(c + 4);
-					fontcolor[1] = *(c + 5);
-					fontcolor[2] = *(c + 2);
-					fontcolor[3] = *(c + 3);
-					fontcolor[4] = *c;
-					fontcolor[5] = *(c + 1);
-
-					c += 8;
-				}
-				else if (!g_ascii_strncasecmp(c, "face=\"", 6))
-				{
-					const char *end = NULL;
-					unsigned int namelen = 0;
-
-					c += 6;
-					end = strchr(c, '\"');
-					namelen = (unsigned int)(end - c);
-					fontface = g_strndup(c, namelen);
-					c = end + 2;
-				}
-				else
-				{
-					/* Drop all unrecognized/misparsed font tags */
-					while (g_ascii_strncasecmp(c, "\">", 2))
-						c++;
-
-					c += 2;
-				}
-			}
-			else
-			{
-				while (g_ascii_strncasecmp(c, ">", 1))
-					c++;
-
-				c++;
-			}
-		}
-		else
-			msg[retcount++] = *c++;
-	}
-
-	if (fontface == NULL)
-		fontface = g_strdup("MS Sans Serif");
-
-	*attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0",
-								  encode_spaces(fontface),
-								  fonteffect, fontcolor);
-	*message = g_strdup(msg);
-
-	g_free(fontface);
-	g_free(msg);
-}
--- a/src/protocols/msn/utils.h	Tue Mar 30 17:44:40 2004 +0000
+++ b/src/protocols/msn/utils.h	Wed Mar 31 02:27:30 2004 +0000
@@ -33,15 +33,4 @@
  */
 void msn_parse_format(const char *mime, char **pre_ret, char **post_ret);
 
-/**
- * Parses the Gaim message formatting (html) into the MSN format.
- *
- * @param html			The html message to format.
- * @param attributes	The returned attributes string.
- * @param message		The returned message string.
- *
- * @return The new message.
- */
-void msn_import_html(const char *html, char **attributes, char **message);
-
 #endif /* _MSN_UTILS_H_ */