evolution-rss r429 - trunk/src
- From: lucilanga svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-rss r429 - trunk/src
- Date: Mon, 19 Jan 2009 20:35:48 +0000 (UTC)
Author: lucilanga
Date: Mon Jan 19 20:35:48 2009
New Revision: 429
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=429&view=rev
Log:
2009-01-12 Lucian Langa <lucilanga gnome org>
* src/rss.c - fetch_comments() support
for fetching/updating comments while
browsing article
* src/parser.c - layer_find_tag_prop
new function for parsing media tag properties
Modified:
trunk/src/fetch.c
trunk/src/network-soup.c
trunk/src/parser.c
trunk/src/parser.h
trunk/src/rss.c
trunk/src/rss.h
Modified: trunk/src/fetch.c
==============================================================================
--- trunk/src/fetch.c (original)
+++ trunk/src/fetch.c Mon Jan 19 20:35:48 2009
@@ -29,12 +29,13 @@
gchar *scheme = NULL;
GString *result = NULL;
+ FILE *f = NULL;
scheme = g_uri_parse_scheme(url);
d(g_print("scheme:%s\n", scheme));
if (!g_ascii_strcasecmp(scheme, "file")) {
gchar *fname = g_filename_from_uri(url, NULL, NULL);
- FILE *f = g_fopen(fname, "rb");
+ f = g_fopen(fname, "rb");
g_free(fname);
g_free(scheme);
if (f == NULL)
@@ -74,7 +75,7 @@
gio_finish_feed,
cbdata2,
0,
- &err);
+ err);
} else {
g_free(scheme);
return net_get_unblocking(url,
@@ -83,7 +84,7 @@
cb2,
cbdata2,
track,
- &err);
+ err);
}
}
Modified: trunk/src/network-soup.c
==============================================================================
--- trunk/src/network-soup.c (original)
+++ trunk/src/network-soup.c Mon Jan 19 20:35:48 2009
@@ -406,17 +406,20 @@
GError **err)
{
SoupMessage *msg;
- CallbackInfo *info;
+ CallbackInfo *info = NULL;
SoupSession *soup_sess =
// soup_session_async_new_with_options(SOUP_SESSION_TIMEOUT, SS_TIMEOUT, NULL);
soup_session_async_new();
proxify_session(soup_sess);
- info = g_new0(CallbackInfo, 1);
- info->user_cb = cb;
- info->user_data = data;
- info->current = 0;
- info->total = 0;
+ if (cb && data) {
+ info = g_new0(CallbackInfo, 1);
+ info->user_cb = cb;
+ info->user_data = data;
+ info->current = 0;
+ info->total = 0;
+ }
+
if (!rf->session)
rf->session = g_hash_table_new(g_direct_hash, g_direct_equal);
if (!rf->abort_session)
@@ -459,7 +462,8 @@
#endif
g_free(agstr);
- g_signal_connect(G_OBJECT(msg), "got_chunk",
+ if (info)
+ g_signal_connect(G_OBJECT(msg), "got_chunk",
G_CALLBACK(got_chunk_cb), info); //FIXME Find a way to free this maybe weak_ref
soup_session_queue_message (soup_sess, msg,
Modified: trunk/src/parser.c
==============================================================================
--- trunk/src/parser.c (original)
+++ trunk/src/parser.c Mon Jan 19 20:35:48 2009
@@ -417,7 +417,7 @@
g_print("syndication\n");
}
-void
+gchar *
wfw_rss(xmlNode *node, gchar *fail)
{
gchar *content;
@@ -800,93 +800,39 @@
gchar *md2 = g_strdup(layer_find(channel->children, "date",
layer_find(channel->children, "pubDate",
layer_find(channel->children, "updated", NULL))));
-
+ r->maindate = md2;
r->total = item->len;
-
- r->feedid = update_channel(
- //atempt to find real_channel name using url
- t,
- r->uri,
- md2,
- item,
- r->progress);
- if (md2)
- g_free(md2);
- g_array_free(item, TRUE);
- g_free(r->feedid);
- return t;
+ r->item = item;
+ r->title = t;
}
-gchar *
-update_channel(const char *chn_name, gchar *url, char *main_date, GArray *item, GtkWidget *progress)
+create_feed *
+parse_channel_line(xmlNode *top, gchar *feed_name, char *main_date)
{
- guint i;
- gchar *sender;
- CamelStore *store = mail_component_peek_local_store(NULL);
- char *d2 = NULL;
- xmlNodePtr el;
char *q = NULL;
char *b = NULL;
+ char *d2 = NULL;
gchar *feed = NULL;
- gboolean freeb = 0; //if b needs to be freed or not
- gchar *encl, *encl_file;
+ gchar *encl;
xmlChar *buff = NULL;
- int size = 0;
-
- gchar *safes = encode_rfc2047(chn_name);
-
- sender = g_strdup_printf("%s <%s>", safes, chn_name);
- g_free(safes);
-
- migrate_crc_md5(chn_name, url);
-
- gchar *buf = gen_md5(url);
-
- gchar *feed_dir = rss_component_peek_base_directory(mail_component_peek());
- if (!g_file_test(feed_dir, G_FILE_TEST_EXISTS))
- g_mkdir_with_parents (feed_dir, 0755);
-
- gchar *feed_name = g_strdup_printf("%s/%s", feed_dir, buf);
- g_free(feed_dir);
-
- FILE *fr = fopen(feed_name, "r");
- FILE *fw = fopen(feed_name, "a+");
- //int fw = g_open (feed_name, O_WRONLY | O_CREAT| O_APPEND | O_BINARY, 0666);
-
- for (i=0; NULL != (el = g_array_index(item, xmlNodePtr, i)); i++)
- {
- update_sr_message();
- if (rf->cancel) goto out;
+ guint size = 0;
- if (progress)
- {
- gdouble fraction = (gdouble)i/item->len;
- gtk_progress_bar_set_fraction((GtkProgressBar *)progress, fraction);
- gchar *msg = g_strdup_printf("%2.0f%% done", fraction*100);
- gtk_progress_bar_set_text((GtkProgressBar *)progress, msg);
- g_free(msg);
- }
-
- char *p = layer_find (el->children, "title", "Untitled article");
- //firstly try to parse as an ATOM author
- //process person construct
- char *q1 = g_strdup(layer_find_innerhtml (el->children, "author", "name", NULL));
- char *q2 = g_strdup(layer_find_innerhtml (el->children, "author", "uri", NULL));
- char *q3 = g_strdup(layer_find_innerhtml (el->children, "author", "email", NULL));
- if (q1)
- {
- q1 = g_strdelimit(q1, "><", ' ');
- gchar *qsafe = encode_rfc2047(q1);
- if (q3)
- {
- q3 = g_strdelimit(q3, "><", ' ');
- q = g_strdup_printf("%s <%s>", qsafe, q3);
+ char *p = g_strdup(layer_find (top, "title", "Untitled article"));
+ //firstly try to parse as an ATOM author
+ //process person construct
+ char *q1 = g_strdup(layer_find_innerhtml (top, "author", "name", NULL));
+ char *q2 = g_strdup(layer_find_innerhtml (top, "author", "uri", NULL));
+ char *q3 = g_strdup(layer_find_innerhtml (top, "author", "email", NULL));
+ if (q1) {
+ q1 = g_strdelimit(q1, "><", ' ');
+ gchar *qsafe = encode_rfc2047(q1);
+ if (q3) {
+ q3 = g_strdelimit(q3, "><", ' ');
+ q = g_strdup_printf("%s <%s>", qsafe, q3);
g_free(q1);
if (q2) g_free(q2);
g_free(q3);
- }
- else
- {
+ } else {
if (q2)
q2 = g_strdelimit(q2, "><", ' ');
else
@@ -896,20 +842,17 @@
g_free(q2);
}
g_free(qsafe);
- }
- else //then RSS or RDF
- {
+ } else { //then RSS or RDF
xmlNodePtr source;
- source = layer_find_pos(el->children, "source", "author");
+ source = layer_find_pos(top, "source", "author");
//try the source construct
//source = layer_find_pos(el->children, "source", "contributor");
if (source != NULL)
q = g_strdup(layer_find(source, "name", NULL));
else
- q = g_strdup(layer_find (el->children, "author",
- layer_find (el->children, "creator", NULL)));
- if (q)
- {
+ q = g_strdup(layer_find (top, "author",
+ layer_find (top, "creator", NULL)));
+ if (q) {
//evo will go crazy when it'll encounter ":" character
//it probably enforces strict rfc2047 compliance
q = g_strdelimit(q, "><:", ' ');
@@ -923,140 +866,194 @@
}
}
//FIXME this might need xmlFree when namespacing
- b = layer_find_tag (el->children, "description",
- layer_find_tag (el->children, "content",
- layer_find_tag (el->children, "summary",
+ b = layer_find_tag (top, "description",
+ layer_find_tag (top, "content",
+ layer_find_tag (top, "summary",
NULL)));
if (!b)
- b = g_strdup(layer_find (el->children, "description",
- layer_find (el->children, "content",
- layer_find (el->children, "summary", "No information"))));
+ b = g_strdup(layer_find (top, "description",
+ layer_find (top, "content",
+ layer_find (top, "summary", "No information"))));
- char *d = layer_find (el->children, "pubDate", NULL);
+ char *d = layer_find (top, "pubDate", NULL);
//date in dc module format
- if (!d)
- {
- d2 = layer_find (el->children, "date", NULL); //RSS2
- if (!d2)
- {
- d2 = layer_find(el->children, "updated", NULL); //ATOM
+ if (!d) {
+ d2 = layer_find (top, "date", NULL); //RSS2
+ if (!d2) {
+ d2 = layer_find(top, "updated", NULL); //ATOM
if (!d2) //take channel date if exists
- d2 = main_date;
+ d2 = g_strdup(main_date);
}
}
//<enclosure url=>
//handle multiple enclosures
- encl = layer_find_innerelement(el->children, "enclosure", "url", // RSS 2.0 Enclosure
- layer_find_innerelement(el->children, "link", "enclosure", NULL)); // ATOM Enclosure
+ encl = layer_find_innerelement(top, "enclosure", "url", // RSS 2.0 Enclosure
+ layer_find_innerelement(top, "link", "enclosure", NULL)); // ATOM Enclosure
// encl = layer_find_tag_prop(el->children, "media", "url", // RSS 2.0 Enclosure
// NULL); // ATOM Enclosure
//we have to free this somehow
//<link></link>
- char *link = g_strdup(layer_find (el->children, "link", NULL)); //RSS,
+ char *link = g_strdup(layer_find (top, "link", NULL)); //RSS,
if (!link) // <link href=>
- link = layer_find_innerelement(el->children, "link", "href",
+ link = layer_find_innerelement(top, "link", "href",
g_strdup(_("No Information"))); //ATOM
- char *comments = g_strdup(layer_find (el->children, "comments", NULL)); //RSS,
- comments = layer_find_ns_tag(el->children, "wfw", "commentRss", NULL); //add slash:comments
-
- char *id = layer_find (el->children, "id", //ATOM
- layer_find (el->children, "guid", NULL)); //RSS 2.0
+ char *comments = g_strdup(layer_find (top, "comments", NULL)); //RSS,
+ comments = layer_find_ns_tag(top, "wfw", "commentRss", NULL); //add slash:comments
+ char *id = layer_find (top, "id", //ATOM
+ layer_find (top, "guid", NULL)); //RSS 2.0
feed = g_strdup_printf("%s\n", id ? id : link);
d(g_print("link:%s\n", link));
d(g_print("author:%s\n", q));
- d(g_print("sender:%s\n", sender));
d(g_print("title:%s\n", p));
d(g_print("date:%s\n", d));
d(g_print("date:%s\n", d2));
-
- gchar rfeed[513];
- memset(rfeed, 0, 512);
- int occ = 0;
+
+ //not very nice but prevents unnecessary long body processing
+ if (!feed_is_new(feed_name, feed)) {
+ ftotal++;
+ p = decode_html_entities (p);
+ gchar *tmp = decode_utf8_entities(b);
+ g_free(b);
+
+ xmlDoc *src = (xmlDoc *)parse_html_sux(tmp, strlen(tmp));
+ if (src)
+ {
+ xmlNode *doc = (xmlNode *)src;
+
+ while (doc = html_find(doc, "img"))
+ {
+ gchar *name = NULL;
+ xmlChar *url = xmlGetProp(doc, "src");
+ if (url) {
+ if (name = fetch_image(url))
+ xmlSetProp(doc, "src", name);
+ xmlFree(url);
+ }
+ }
+ xmlDocDumpMemory(src, &buff, &size);
+ xmlFree(src);
+ }
+ g_free(tmp);
+ b=buff;
+ }
+
+ create_feed *CF = g_new0(create_feed, 1);
+ /* pack all data */
+ CF->q = g_strdup(q);
+ CF->subj = g_strdup(p);
+ CF->body = g_strdup(b);
+ CF->date = g_strdup(d);
+ CF->dcdate = g_strdup(d2);
+ CF->website = g_strdup(link);
+ CF->encl = g_strdup(encl);
+ CF->comments = g_strdup(comments);
+ CF->feed_fname = g_strdup(feed_name); //feed file name
+ CF->feed_uri = g_strdup(feed); //feed file url
+ g_free(p);
+ if (q) g_free(q);
+ g_free(b);
+ if (feed) g_free(feed);
+ if (encl) g_free(encl);
+ g_free(link);
+ return CF;
+
+}
+
+gchar *
+update_comments(RDF *r)
+{
+ guint i;
+ create_feed *CF;
+ xmlNodePtr el;
+ for (i=0; NULL != (el = g_array_index(r->item, xmlNodePtr, i)); i++) {
+ CF = parse_channel_line(el->children, NULL, NULL);
+ print_cf(CF);
+ }
+}
+
+gchar *
+update_channel(RDF *r)
+{
+ guint i;
+ gchar *sender;
+ char *d2 = NULL;
+ xmlNodePtr el;
+ char *q = NULL;
+ char *b = NULL;
+ gchar *encl;
+ gchar *subj;
+ create_feed *CF;
+ gchar *chn_name = r->title;
+ gchar *url = r->uri;
+ gchar *main_date = r->maindate;
+ GArray *item = r->item;
+ GtkWidget *progress = r->progress;
+
+ gchar *safes = encode_rfc2047(chn_name);
+
+ sender = g_strdup_printf("%s <%s>", safes, chn_name);
+ g_free(safes);
+
+ migrate_crc_md5(chn_name, url);
+
+ gchar *buf = gen_md5(url);
+
+ gchar *feed_dir = rss_component_peek_base_directory(mail_component_peek());
+ if (!g_file_test(feed_dir, G_FILE_TEST_EXISTS))
+ g_mkdir_with_parents (feed_dir, 0755);
+
+ gchar *feed_name = g_strdup_printf("%s/%s", feed_dir, buf);
+ g_free(feed_dir);
+
+ FILE *fr = fopen(feed_name, "r");
+ FILE *fw = fopen(feed_name, "a+");
+ //int fw = g_open (feed_name, O_WRONLY | O_CREAT| O_APPEND | O_BINARY, 0666);
+
+ for (i=0; NULL != (el = g_array_index(item, xmlNodePtr, i)); i++) {
+ update_sr_message();
+ if (rf->cancel) goto out;
+
+ if (progress) {
+ gdouble fraction = (gdouble)i/item->len;
+ gtk_progress_bar_set_fraction((GtkProgressBar *)progress, fraction);
+ gchar *msg = g_strdup_printf("%2.0f%% done", fraction*100);
+ gtk_progress_bar_set_text((GtkProgressBar *)progress, msg);
+ g_free(msg);
+ }
+
+ CF = parse_channel_line(el->children, feed_name, main_date);
+ CF->feedid = g_strdup(buf);
+ CF->sender = g_strdup(sender);
+ CF->full_path = g_strdup(chn_name);
+ subj = CF->subj;
while (gtk_events_pending())
gtk_main_iteration ();
- if (!feed_is_new(feed_name, feed)) {
+ if (!feed_is_new(feed_name, CF->feed_uri)) {
ftotal++;
- p = decode_html_entities (p);
- gchar *tmp = decode_utf8_entities(b);
- g_free(b);
-
- xmlDoc *src = (xmlDoc *)parse_html_sux(tmp, strlen(tmp));
- if (src)
- {
- xmlNode *doc = (xmlNode *)src;
-
- while (doc = html_find(doc, "img"))
- {
- gchar *name = NULL;
- xmlChar *url = xmlGetProp(doc, "src");
- if (url) {
- if (name = fetch_image(url))
- xmlSetProp(doc, "src", name);
- xmlFree(url);
- }
- }
- xmlDocDumpMemory(src, &buff, &size);
- xmlFree(src);
- }
- g_free(tmp);
-// tmp = decode_html_entities(buff);
-// tmp = xmlEncodeSpecialChars(NULL, buff);
-// b = tmp;
-// g_free(b);
- b=buff;
-
- while (gtk_events_pending())
- gtk_main_iteration ();
-
- create_feed *CF = g_new0(create_feed, 1);
- /* pack all data */
- CF->full_path = g_strdup(chn_name);
- CF->q = g_strdup(q);
- CF->sender = g_strdup(sender);
- CF->subj = g_strdup(p);
- CF->body = g_strdup(b);
- CF->date = g_strdup(d);
- CF->dcdate = g_strdup(d2);
- CF->website = g_strdup(link);
- CF->feedid = g_strdup(buf);
- CF->encl = g_strdup(encl);
- CF->comments = g_strdup(comments);
- CF->feed_fname = g_strdup(feed_name); //feed file name
- CF->feed_uri = g_strdup(feed); //feed file url
-
- if (encl)
- {
+ if (CF->encl) {
GError *err = NULL;
net_get_unblocking(
- encl,
+ CF->encl,
textcb,
NULL,
(gpointer)finish_enclosure,
CF,
0,
&err);
- }
- else
- {
+ } else {
create_mail(CF);
- write_feed_status_line(feed_name, feed);
+ write_feed_status_line(CF->feed_fname, CF->feed_uri);
free_cf(CF);
}
farticle++;
- update_status_icon(chn_name, p);
- g_free(p);
+ d(g_print("put success()\n"));
+ update_status_icon(chn_name, subj);
}
- d(g_print("put success()\n"));
-tout: if (q) g_free(q);
- g_free(b);
- if (feed) g_free(feed);
- if (encl) g_free(encl);
- g_free(link);
}
out: g_free(sender);
Modified: trunk/src/parser.h
==============================================================================
--- trunk/src/parser.h (original)
+++ trunk/src/parser.h Mon Jan 19 20:35:48 2009
@@ -19,7 +19,7 @@
#ifndef __PARSER_H__
#define __PARSER_H__
-gchar *update_channel(const char *chn_name, char *url, char *main_date, GArray *item, GtkWidget *progress);
+gchar *update_channel(RDF *r);
static char *layer_find (xmlNodePtr node, char *match, char *fail);
static char *layer_find_innerelement (xmlNodePtr node, char *match, char *el, char *fail);
Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c (original)
+++ trunk/src/rss.c Mon Jan 19 20:35:48 2009
@@ -175,9 +175,11 @@
rssfeed *rf = NULL;
gboolean inhibit_read = FALSE; //prevent mail selection when deleting folder
+gchar *commstream = NULL; //global comments stream
gboolean setup_feed(add_feed *feed);
gchar *display_doc (RDF *r);
+gchar *display_comments (RDF *r);
void check_folders(void);
gchar *strplchr(gchar *source);
static char *gen_md5(gchar *buffer);
@@ -230,6 +232,17 @@
gchar *
decode_entities(gchar *source);
+
+struct _rfMessage {
+ guint status_code;
+ gchar *body;
+ goffset length;
+};
+
+typedef struct _rfMessage rfMessage;
+
+void generic_finish_feed(rfMessage *msg, gpointer user_data);
+
/*======================================================================*/
gpointer
@@ -1572,6 +1585,9 @@
g_free(po->website);
}
+EMFormat *fom;
+CamelStream *som;
+
void org_gnome_cooly_format_rss(void *ep, EMFormatHookTarget *t);
void org_gnome_cooly_format_rss(void *ep, EMFormatHookTarget *t) //camelmimepart
@@ -1605,7 +1621,7 @@
goto fmerror;
gchar *addr = (gchar *)camel_header_location_decode(website);
feedid = (gchar *)camel_medium_get_header (CAMEL_MEDIUM(message), "RSS-ID");
- comments = g_strstrip((gchar *)camel_medium_get_header (CAMEL_MEDIUM(message), "X-Evolution-rss-comments"));
+ comments = (gchar *)camel_medium_get_header (CAMEL_MEDIUM(message), "X-Evolution-rss-comments");
gchar *subject = camel_header_decode_string(camel_medium_get_header (CAMEL_MEDIUM (message),
"Subject"), NULL);
gchar *f = camel_header_decode_string(camel_medium_get_header (CAMEL_MEDIUM (message),
@@ -1614,7 +1630,9 @@
gpointer is_html = NULL;
if (feedid)
- is_html = g_hash_table_lookup(rf->hrh, g_strstrip(feedid));
+ is_html = g_hash_table_lookup(rf->hrh, g_strstrip(feedid));
+ if (comments)
+ comments = g_strstrip(comments);
if (!rf->chg_format)
rf->cur_format = GPOINTER_TO_INT(is_html);
@@ -1741,6 +1759,7 @@
website, subject);
camel_stream_printf (fstream, "<tr><td><font colour=#%06x>%s</font></td></tr>", text_colour & 0xffffff, buff);
camel_stream_printf (fstream, "</table></div>");
+// g_print("comments:%s|\n", comments);
if (comments) {
camel_stream_printf (fstream,
"<br><div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n",
@@ -1751,13 +1770,20 @@
content_colour & 0xEDECEB & 0xffffff,
comments);
camel_stream_printf (fstream, "</table></div>");
- fetch_comments(comments);
+ if (commstream) {
+// camel_stream_printf (fstream, "%s", commstream);
+ print_comments(comments, commstream);
+ commstream = NULL;
+ }
+ else {
+ fetch_comments(comments, t->format);
+ }
}
}
//this is required for proper charset rendering when html
- camel_data_wrapper_construct_from_stream(dw, fstream);
- camel_medium_set_content_object((CamelMedium *)part, dw);
+ camel_data_wrapper_construct_from_stream(dw, fstream);
+ camel_medium_set_content_object((CamelMedium *)part, dw);
em_format_format_text((EMFormat *)t->format, (CamelStream *)t->stream, (CamelDataWrapper *)part);
// gtk_html_select_all(t->format->message);
camel_object_unref(dw);
@@ -2146,13 +2172,6 @@
g_hash_table_replace(rf->hrttl, g_strdup(key), GINT_TO_POINTER(value));
}
-struct _rfMessage {
- guint status_code;
- gchar *body;
- goffset length;
-};
-
-typedef struct _rfMessage rfMessage;
void
#if LIBSOUP_VERSION < 2003000
@@ -2167,7 +2186,7 @@
rfmsg->body = msg->response.body;
rfmsg->length = msg->response.length;
#else
- rfmsg->body = msg->response_body->data;
+ rfmsg->body = (gchar *)(msg->response_body->data);
rfmsg->length = msg->response_body->length;
#endif
generic_finish_feed(rfmsg, user_data);
@@ -2469,6 +2488,7 @@
finish_comments (SoupSession *soup_sess, SoupMessage *msg, gpointer user_data)
#endif
{
+ guint reload=0;
taskbar_op_set_progress("comments", "www", 0.01);
// if (!msg->length)
@@ -2482,14 +2502,44 @@
//#ifdef RSS_DEBUG
// g_print("feed %s\n", user_data);
//#endif
+ if (!commstream)
+ reload = 1;
g_print("response:%s\n", response->str);
+ commstream = response->str;
+ if (reload)
+ em_format_redraw((EMFormat *)user_data);
+
while (gtk_events_pending ())
gtk_main_iteration ();
}
+print_comments(gchar *url, gchar *stream)
+{
+ RDF *r = NULL;
+ r = g_new0 (RDF, 1);
+ r->shown = TRUE;
+ xmlDocPtr doc = NULL;
+ xmlNodePtr root = NULL;
+ xmlSubstituteEntitiesDefaultValue = 0;
+ doc = xml_parse_sux (stream, strlen(stream));
+// d(g_print("content:\n%s\n", content->str));
+ root = xmlDocGetRootElement(doc);
+
+ if ((doc != NULL && root != NULL)
+ && (strcasestr(root->name, "rss")
+ || strcasestr(root->name, "rdf")
+ || strcasestr(root->name, "feed"))) {
+ r->cache = doc;
+ r->uri = url;
+
+ display_comments (r);
+ }
+}
-fetch_comments(gchar *url)
+
+void
+fetch_comments(gchar *url, CamelStream *stream)
{
GError *err = NULL;
g_print("\nFetching comments from: %s\n",
@@ -2500,7 +2550,7 @@
NULL,
NULL,
(gpointer)finish_comments,
- NULL, // we need to dupe key here
+ stream, // we need to dupe key here
1,
&err); // because we might lose it if
// feed gets deleted
@@ -3698,6 +3748,26 @@
}
void
+print_cf(create_feed *CF)
+{
+ g_print("Sender: %s ", CF->sender);
+ g_print("Subject: %s \n", CF->subj);
+ g_print("Date: %s\n", CF->date);
+ g_print("Feedid: %s\n", CF->feedid);
+ g_print("==========================\n");
+ g_print("Name: %s ", CF->feed_fname);
+ g_print("URI: %s\n", CF->feed_uri);
+ g_print("Path: %s\n", CF->full_path);
+ g_print("Website: %s\n", CF->website);
+ g_print("==========================\n");
+ g_print("%s\n", CF->body);
+ g_print("==========================\n");
+ g_print("q: %s\n", CF->q);
+ g_print("encl: %s\n", CF->encl);
+ g_print("dcdate: %s\n", CF->dcdate);
+}
+
+void
free_cf(create_feed *CF)
{
g_free(CF->full_path);
@@ -3968,7 +4038,7 @@
gchar *string, *result;
const unsigned char *s;
guint len;
- gpointer in, out;
+ int in, out;
int state, pos;
g_string_append(res, source);
@@ -3996,7 +4066,7 @@
len--;
}
if (state == 2) {
- htmlEntityDesc *my = htmlEntityLookup((xmlChar *)str->str);
+ htmlEntityDesc *my = (htmlEntityDesc *)htmlEntityLookup((xmlChar *)str->str);
if (my) {
g_string_erase(res, in, out-in);
g_string_insert_unichar(res, in, my->value);
@@ -4076,12 +4146,30 @@
return rfctmp;
}
+gchar *
+display_comments (RDF *r)
+{
+ xmlNodePtr root = xmlDocGetRootElement (r->cache);
+ tree_walk (root, r);
+ r->feedid = update_comments(r);
+ if (r->maindate)
+ g_free(r->maindate);
+ g_array_free(r->item, TRUE);
+ g_free(r->feedid);
+}
gchar *
display_doc (RDF *r)
{
xmlNodePtr root = xmlDocGetRootElement (r->cache);
- return tree_walk (root, r);
+ tree_walk (root, r);
+ g_print("chn_name:%s\n", r->title);
+ r->feedid = update_channel(r);
+ if (r->maindate)
+ g_free(r->maindate);
+ g_array_free(r->item, TRUE);
+ g_free(r->feedid);
+ return r->title;
}
static void
Modified: trunk/src/rss.h
==============================================================================
--- trunk/src/rss.h (original)
+++ trunk/src/rss.h Mon Jan 19 20:35:48 2009
@@ -48,6 +48,9 @@
guint type_id; //num type
gchar *version; //feed version
gchar *feedid; //md5 string id of feed
+ gchar *title; //title of the feed
+ gchar *maindate; //channel date
+ GArray *item; //feed content
GtkWidget *progress;
guint total; //total articles
guint ttl; //feed specified refresh interval
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]