evolution-rss r299 - trunk/src
- From: lucilanga svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-rss r299 - trunk/src
- Date: Fri, 20 Jun 2008 05:29:35 +0000 (UTC)
Author: lucilanga
Date: Fri Jun 20 05:29:35 2008
New Revision: 299
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=299&view=rev
Log:
ttl implementation
Modified:
trunk/src/rss-config-factory.c
trunk/src/rss.c
trunk/src/rss.h
Modified: trunk/src/rss-config-factory.c
==============================================================================
--- trunk/src/rss-config-factory.c (original)
+++ trunk/src/rss-config-factory.c Fri Jun 20 05:29:35 2008
@@ -584,6 +584,7 @@
saved_feed->hrdel_days = GPOINTER_TO_INT(g_hash_table_lookup(rf->hrdel_days, lookup_key(name)));
saved_feed->hrdel_messages = GPOINTER_TO_INT(g_hash_table_lookup(rf->hrdel_messages, lookup_key(name)));
saved_feed->hrdel_unread = GPOINTER_TO_INT(g_hash_table_lookup(rf->hrdel_unread, lookup_key(name)));
+ saved_feed->hrttl = GPOINTER_TO_INT(g_hash_table_lookup(rf->hrttl, lookup_key(name)));
return saved_feed;
}
@@ -604,6 +605,7 @@
g_hash_table_insert(rf->hrdel_days, g_strdup(lookup_key(name)), GINT_TO_POINTER(s->hrdel_days));
g_hash_table_insert(rf->hrdel_messages, g_strdup(lookup_key(name)), GINT_TO_POINTER(s->hrdel_messages));
g_hash_table_insert(rf->hrdel_unread, g_strdup(lookup_key(name)), GINT_TO_POINTER(s->hrdel_unread));
+ g_hash_table_insert(rf->hrttl, g_strdup(lookup_key(name)), GINT_TO_POINTER(s->hrttl));
g_free(s);
}
@@ -621,6 +623,7 @@
g_hash_table_remove(rf->hrdel_days, lookup_key(name));
g_hash_table_remove(rf->hrdel_messages, lookup_key(name));
g_hash_table_remove(rf->hrdel_unread, lookup_key(name));
+ g_hash_table_remove(rf->hrttl, lookup_key(name));
g_hash_table_remove(rf->hrname_r, lookup_key(name));
g_hash_table_remove(rf->hrname, name);
rf->pending = FALSE;
Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c (original)
+++ trunk/src/rss.c Fri Jun 20 05:29:35 2008
@@ -742,17 +742,20 @@
xmlSetProp (src, "unread",
g_hash_table_lookup(rf->hrdel_unread, lookup_key(key)) ? "true" : "false");
+ src = xmlNewTextChild (root, NULL, "ttl", NULL);
+ guint opt = 0;
+ if (g_hash_table_lookup(rf->hrttl, lookup_key(key)))
+ opt = 1;
+ if (!g_hash_table_lookup(rf->hre, lookup_key(key)))
+ opt = 2;
+ ctmp = g_strdup_printf("%d", opt);
+ xmlSetProp (src, "option", ctmp);
+ g_free(ctmp);
+ ctmp = g_strdup_printf("%d", g_hash_table_lookup(rf->hrttl, lookup_key(key)));
+ xmlSetProp (src, "value", ctmp);
+ g_free(ctmp);
-/* if (account->id->address)
- xmlNewTextChild (id, NULL, "addr-spec", account->id->address);
- if (account->id->reply_to)
- xmlNewTextChild (id, NULL, "reply-to", account->id->reply_to);
- if (account->id->organization)
- xmlNewTextChild (id, NULL, "organization", account->id->organization);
-
- node = xmlNewChild (id, NULL, "signature",NULL);
- xmlSetProp (node, "uid", key);
-
+/*
src = xmlNewChild (root, NULL, "source", NULL);
xmlSetProp (src, "save-passwd", account->source->save_passwd ? "true" : "false");
xmlSetProp (src, "keep-on-server", account->source->keep_on_server ? "true" : "false");
@@ -1027,6 +1030,7 @@
guint del_days=0;
guint del_messages=0;
guint del_unread=0;
+ guint ttl=0;
gchar *ctmp = NULL;
if (!(doc = xmlParseDoc ((char *)xml)))
@@ -1060,8 +1064,13 @@
xml_set_prop (node, "messages", &ctmp);
del_messages = atoi(ctmp);
xml_set_bool (node, "unread", &del_unread);
+ }
+ if (!strcmp (node->name, "ttl")) {
+ xml_set_prop (node, "value", &ctmp);
+ ttl = atoi(ctmp);
if (ctmp) g_free(ctmp);
}
+
}
g_hash_table_insert(rf->hrname, name, uid);
@@ -1086,6 +1095,9 @@
g_hash_table_insert(rf->hrdel_unread,
g_strdup(uid),
GINT_TO_POINTER(del_unread));
+ g_hash_table_insert(rf->hrttl,
+ g_strdup(uid),
+ GINT_TO_POINTER(ttl));
}
char *
@@ -1201,6 +1213,7 @@
rf->hrdel_days = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
rf->hrdel_messages = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
rf->hrdel_unread = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ rf->hrttl = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
if (g_file_test(feed_file, G_FILE_TEST_EXISTS))
migrate_old_config(feed_file);
@@ -2120,6 +2133,11 @@
g_str_equal,
g_free,
NULL);
+ if (rf->hrttl == NULL)
+ rf->hrttl = g_hash_table_new_full(g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
rf->pending = TRUE;
@@ -2190,6 +2208,9 @@
g_hash_table_insert(rf->hrdel_unread,
g_strdup(crc_feed),
GINT_TO_POINTER(feed->del_unread));
+ g_hash_table_insert(rf->hrttl,
+ g_strdup(crc_feed),
+ GINT_TO_POINTER(r->ttl));
gchar *ver = NULL;
if (r->type && r->version)
@@ -2238,6 +2259,14 @@
}
void
+update_ttl(gpointer key, guint value)
+{
+ if (!g_hash_table_lookup(rf->hrttl, key)
+ && g_hash_table_lookup(rf->hre, key))
+ g_hash_table_replace(rf->hrttl, g_strdup(key), value);
+}
+
+void
#if LIBSOUP_VERSION < 2003000
finish_feed (SoupMessage *msg, gpointer user_data)
#else
@@ -2398,6 +2427,7 @@
save_gconf_feed();
}
g_free(chn_name);
+ update_ttl(lookup_key(user_data), r->ttl);
}
if (r->cache)
xmlFreeDoc(r->cache);
@@ -3725,7 +3755,11 @@
t = tmp;
t = generate_safe_chn_name(t);
}
- r->ttl = layer_find(channel->children, "ttl", NULL);
+ gchar *tmp = layer_find(channel->children, "ttl", NULL);
+ if (tmp)
+ r->ttl = atoi(tmp);
+ else
+ r->ttl = 0;
//items might not have a date
// so try to grab channel/feed date
Modified: trunk/src/rss.h
==============================================================================
--- trunk/src/rss.h (original)
+++ trunk/src/rss.h Fri Jun 20 05:29:35 2008
@@ -59,6 +59,7 @@
guint hrdel_days;
guint hrdel_messages;
guint hrdel_unread;
+ guint hrttl;
} hrfeed;
typedef struct _rssfeed {
@@ -77,6 +78,7 @@
GHashTable *hrdel_days; //option to delete messages older then days
GHashTable *hrdel_messages; //option to keep last messages
GHashTable *hrdel_unread; //option to delete unread messages too
+ GHashTable *hrttl; //feeds name hash
GtkWidget *feed_dialog;
GtkWidget *progress_dialog;
GtkWidget *progress_bar;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]