[evolution-ews] Implement stripping of html tags



commit 313e7f60c75e8a3c7c809ef2979a973c4d87f672
Author: Or Goshen <orx goshen intel com>
Date:   Mon Jul 4 16:11:23 2011 +0300

    Implement stripping of html tags

 src/server/e-ews-item.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index 5e9ae5f..2b853fc 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -740,7 +740,20 @@ parse_contact_field (EEwsItem *item, const gchar *name, ESoapParameter *subparam
 static gchar *
 strip_html_tags (const gchar *html_text)
 {
-	return g_strdup (html_text);
+	gssize haystack_len = strlen (html_text);
+	gchar *plain_text = g_malloc (haystack_len);
+	gchar *start = g_strstr_len (html_text, haystack_len, "<body>"),
+		*end = g_strstr_len (html_text, haystack_len, "</body>"),
+		*i, *j;
+
+	for (j = plain_text, i = start + 6; i < end; i++) {
+		if (*i == '<') { while (*i != '>') i++; }
+		else { *j = *i; j++; }
+	}
+
+	*j = '\0';
+
+	return plain_text;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]