evolution-rss r414 - in trunk: . src
- From: lucilanga svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-rss r414 - in trunk: . src
- Date: Mon, 15 Dec 2008 07:47:20 +0000 (UTC)
Author: lucilanga
Date: Mon Dec 15 07:47:19 2008
New Revision: 414
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=414&view=rev
Log:
2008-12-15 Lucian Langa <lucilanga gnome org>
* src/rss.c: decode_entities: new function
for correctly parse title as rfc2047
Modified:
trunk/ChangeLog
trunk/TODO
trunk/src/parser.c
trunk/src/rss.c
Modified: trunk/TODO
==============================================================================
--- trunk/TODO (original)
+++ trunk/TODO Mon Dec 15 07:47:19 2008
@@ -22,7 +22,6 @@
* test new proxy authentification
* cache large feeds
* hook feed properties in folder properties
- * strip html tags from title
* if necessary implement config code for evo 2.12
* fix recursivity on layer_find_pos
* fix annoying cursor jump when browsing through evo-rss folders
@@ -46,3 +45,4 @@
name=<value optimized out>, error=<value optimized out>,
emsg=<value optimized out>) at rss.c:273
* implement right-click in browse
+ * strip html tags from title - correctly process international text (rfc2047)
Modified: trunk/src/parser.c
==============================================================================
--- trunk/src/parser.c (original)
+++ trunk/src/parser.c Mon Dec 15 07:47:19 2008
@@ -738,6 +738,9 @@
update_channel(const char *chn_name, gchar *url, char *main_date, GArray *item, GtkWidget *progress)
{
guint i;
+ //name must be set according to rfc2047
+ //gchar *safe_channel = camel_header_encode_string(
+ g_print("chn_name:%s\n", chn_name);
gchar *sender = g_strdup_printf("%s <%s>", chn_name, chn_name);
CamelStore *store = mail_component_peek_local_store(NULL);
char *d2 = NULL;
Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c (original)
+++ trunk/src/rss.c Mon Dec 15 07:47:19 2008
@@ -226,6 +226,8 @@
dialog_key_destroy (GtkWidget *widget, gpointer data);
guint fallback_engine(void);
+gchar *
+decode_entities(gchar *source);
/*======================================================================*/
gpointer
@@ -1598,6 +1600,12 @@
feedid = (gchar *)camel_medium_get_header (CAMEL_MEDIUM(message), "RSS-ID");
gchar *subject = camel_header_decode_string(camel_medium_get_header (CAMEL_MEDIUM (message),
"Subject"), NULL);
+ g_print("subject:%s\n", subject);
+ gchar *f = camel_header_decode_string(camel_medium_get_header (CAMEL_MEDIUM (message),
+ "From"), NULL);
+ g_print("from:%s\n", f);
+ gchar *ff = camel_header_encode_string("Dag WieÃrs");
+ g_print("from:%s\n", ff);
gpointer is_html = NULL;
@@ -2947,6 +2955,9 @@
void org_gnome_cooly_rss_startup(void *ep, EMPopupTargetSelect *t)
{
+ gchar *ent = decode_entities("mewëm&e¨w\0");
+ g_print("deco%s\n", ent);
+ g_print("enco%s\n", camel_header_encode_string(ent));
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_START_CHECK, NULL))
{
//as I don't know how to set this I'll setup a 10 secs timeout
@@ -3438,8 +3449,12 @@
addr = camel_internet_address_new();
d(g_print("date:%s\n", CF->date));
- camel_address_decode(CAMEL_ADDRESS(addr), author);
+// g_print("author;%s\n", decode_html("Dag Wieëa"));
+ gchar *safe_author = camel_header_encode_string(author);
+ g_print("sauthor;%s\n", safe_author);
+ camel_address_decode(CAMEL_ADDRESS(addr), safe_author);
camel_mime_message_set_from(new, addr);
+ camel_object_unref(safe_author);
camel_object_unref(addr);
int offset = 0;
@@ -3834,6 +3849,60 @@
}
gchar *
+decode_entities(gchar *source)
+{
+ GString *str = g_string_new(NULL);
+ GString *res = g_string_new(NULL);
+ GString *tmp = g_string_new(NULL);
+ gchar *string, *result;
+ const unsigned char *s;
+ guint len;
+ gpointer in, out;
+ int state, pos;
+
+ g_string_append(res, source);
+reent: s = (const unsigned char *)res->str;
+ len = strlen(res->str);
+ state = 0;
+ pos = 1;
+ g_string_truncate(str, 0);
+ tmp = g_string_new(NULL);
+ while (*s != 0 || len) {
+ if (state) {
+ if (*s==';') {
+ state = 2; //entity found
+ out = pos;
+ break;
+ } else {
+ g_string_append_c(str, *s);
+ }
+ }
+ if (*s=='&') {
+ in = pos-1;
+ state = 1;
+ }
+ *s++;
+ pos++;
+ len--;
+ }
+ if (state == 2) {
+ g_string_erase(res, in, out-in);
+ htmlEntityDesc *my = htmlEntityLookup((xmlChar *)str->str);
+ g_string_printf(tmp, "\\u%04x", my->value);
+ g_string_insert(res, in, tmp->str);
+ g_string_free(tmp, FALSE);
+ gchar *result = res->str;
+ g_string_free(res, FALSE);
+ res = g_string_new(NULL);
+ g_string_append(res, result);
+ goto reent;
+ }
+ result = res->str;
+ g_string_free(res, FALSE);
+ return result;
+}
+
+gchar *
decode_html_entities(gchar *str)
{
gchar *newstr;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]