changeset 20273:187fa336c1b0

Plucked mysapce tag parsing fixes applied changes from c5468fb873563f4e1249323a03f5531e192965f3 through 34d642b12b7215d55fd032cd513a7e225715f19a applied changes from 43e06ba1c67cc326d2d93f14d67709b2375da88b through bf8de57ed4c36f188044ea0684c201d0a1a67169 applied changes from 854642c5c0ea1bb31de3fd0dc5b0c480b70fc327 through 5a661e7759c94109af265616312c40858ae77e27
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 28 Sep 2007 21:30:15 +0000
parents 5c42c7c7780d
children d9e391c08e08
files libpurple/protocols/myspace/markup.c libpurple/protocols/myspace/myspace.h
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/markup.c	Fri Sep 28 20:58:27 2007 +0000
+++ b/libpurple/protocols/myspace/markup.c	Fri Sep 28 21:30:15 2007 +0000
@@ -426,13 +426,14 @@
 html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, 
 		gchar **end)
 {
+	if (!purple_utf8_strcasecmp(root->name, "root") ||
+	    !purple_utf8_strcasecmp(root->name, "html")) {
+		*begin = g_strdup("");
+		*end = g_strdup("");
 	/* TODO: Coalesce nested tags into one <f> tag!
 	 * Currently, the 's' value will be overwritten when b/i/u is nested
 	 * within another one, and only the inner-most formatting will be 
 	 * applied to the text. */
-	if (!purple_utf8_strcasecmp(root->name, "root")) {
-		*begin = g_strdup("");
-		*end = g_strdup("");
 	} else if (!purple_utf8_strcasecmp(root->name, "b")) {
 		*begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_BOLD);
 		*end = g_strdup("</f>");
@@ -503,8 +504,20 @@
 
 		/* TODO: color (bg uses <body>), emoticons */
 	} else {
+		gchar *err;
+
+#ifdef MSIM_MARKUP_SHOW_UNKNOWN_TAGS
 		*begin = g_strdup_printf("[%s]", root->name);
 		*end = g_strdup_printf("[/%s]", root->name);
+#else
+		*begin = g_strdup("");
+		*end = g_strdup("");
+#endif
+
+		err = g_strdup_printf("html_tag_to_msim_markup: unrecognized "
+				"HTML tag %s was sent by the IM client; ignoring", (root->name ? root->name : "(NULL)"));
+		msim_unrecognized(NULL, NULL, err);
+		g_free(err);
 	}
 }
 
--- a/libpurple/protocols/myspace/myspace.h	Fri Sep 28 20:58:27 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.h	Fri Sep 28 21:30:15 2007 +0000
@@ -67,6 +67,10 @@
 /*#define MSIM_DEBUG_LOGIN_CHALLENGE*/
 /*#define MSIM_DEBUG_RXBUF            */
 
+/* Encode unknown HTML tags from IM clients in messages as [tag], instead of 
+ * ignoring. Useful for debugging */
+/*#define MSIM_MARKUP_SHOW_UNKNOWN_TAGS  */
+
 /* Define to cause init_plugin() to run some tests and print
  * the results to the Purple debug log, then exit. Useful to 
  * run with 'pidgin -d' to see the output. Don't define if