[evolution-rss] adapt to latest evolution changes
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] adapt to latest evolution changes
- Date: Fri, 14 Dec 2012 22:04:33 +0000 (UTC)
commit 3d8f06c2c7e9ffe11917406f3a6fe0de4b5da3ee
Author: Lucian Langa <lucilanga gnome org>
Date: Wed Dec 12 14:09:03 2012 +0100
adapt to latest evolution changes
omf.make | 10 +-
scripts/evolution-rss-migrate-feeds | 23 +++
src/Makefile.am | 1 +
src/e-mail-formatter-evolution-rss.c | 337 +++++++++++++++++++++++-----------
src/e-mail-parser-evolution-rss.c | 99 ++++-------
src/misc.c | 18 ++
src/misc.h | 1 +
src/network-soup.c | 1 +
src/parser.c | 1 +
src/rss-config-factory.c | 1 +
src/rss-config.c | 1 +
src/rss-formatter.c | 69 +++++++
src/rss-formatter.h | 10 +
src/rss-image.c | 1 +
src/rss.c | 10 +-
src/rss.h | 6 +-
16 files changed, 406 insertions(+), 183 deletions(-)
---
diff --git a/omf.make b/omf.make
index cb7acba..35dec24 100644
--- a/omf.make
+++ b/omf.make
@@ -36,19 +36,23 @@ omf: omf_timestamp
omf_timestamp: $(omffile)
-for file in $(omffile); do \
- scrollkeeper-preinstall $(docdir)/$(docname).xml $(srcdir)/$$file $$file.out; \
+ absfile=$(srcdir)/$$file; \
+ test -r $$file && absfile=$$file; \
+ scrollkeeper-preinstall $(docdir)/$(docname).xml $$absfile $$file.out; \
done; \
touch omf_timestamp
install-data-hook-omf:
$(mkinstalldirs) $(DESTDIR)$(omf_dest_dir)
for file in $(omffile); do \
- $(INSTALL_DATA) $$file.out $(DESTDIR)$(omf_dest_dir)/$$file; \
+ absfile=$(srcdir)/$$file.out; \
+ test -r $$file.out && absfile=$$file.out; \
+ $(INSTALL_DATA) $$absfile $(DESTDIR)$(omf_dest_dir)/$$file; \
done
-scrollkeeper-update -p $(DESTDIR)$(scrollkeeper_localstate_dir) -o $(DESTDIR)$(omf_dest_dir)
uninstall-local-omf:
- -for file in $(srcdir)/*.omf; do \
+ -for file in $(omffile); do \
basefile=`basename $$file`; \
rm -f $(DESTDIR)$(omf_dest_dir)/$$basefile; \
done
diff --git a/scripts/evolution-rss-migrate-feeds b/scripts/evolution-rss-migrate-feeds
new file mode 100755
index 0000000..9747d44
--- /dev/null
+++ b/scripts/evolution-rss-migrate-feeds
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Migrates the evolution rss feeds stored in gconf to dconf
+# requies GConf2
+
+a=""
+IFS=
+XMLFEEDS=`gconftool-2 -g /apps/evolution/evolution-rss/feeds`
+if [ $XMLFEEDS == 'false' ]; then
+ echo "Feeds already converted. Nothing to do!"
+ exit 0
+for i in $XMLFEEDS; do
+if [ -z $a ]; then
+ a=$a$i
+else
+ a=$a"@"$i
+fi
+done
+IFS=$'\n'
+b=`echo $a|sed -e "s!\ !,!g"`
+echo "gconf->dconf feeds migration done."
+gconftool-2 -s /apps/evolution/evolution-rss/feeds --type bool 0
+dconf write /org/gnome/evolution/plugin/rss/feeds \"$a\"
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 0f3c9ee..7a86c1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -131,6 +131,7 @@ evolution_module_rss_la_CPPFLAGS = \
-DG_LOG_DOMAIN=\"evolution-module-rss\" \
$(EVOLUTION_RSS_EPLUGIN_LIBS)
+
evolution_module_rss_la_LDFLAGS = \
-avoid-version -module $(NO_UNDEFINED)
diff --git a/src/e-mail-formatter-evolution-rss.c b/src/e-mail-formatter-evolution-rss.c
index b76dc8c..4fc9c45 100644
--- a/src/e-mail-formatter-evolution-rss.c
+++ b/src/e-mail-formatter-evolution-rss.c
@@ -34,37 +34,57 @@
#include <X11/Xlib.h>
#include <camel/camel.h>
+#include "misc.h"
#include "rss-formatter.h"
-typedef struct _EMailFormatterRSS EMailFormatterRSS;
-typedef struct _EMailFormatterRSSClass EMailFormatterRSSClass;
-
-struct _EMailFormatterRSS {
- EExtension parent;
-};
-
-struct _EMailFormatterRSSClass {
- EExtensionClass parent_class;
-};
+typedef EMailFormatterExtension EMailFormatterRSS;
+typedef EMailFormatterExtensionClass EMailFormatterRSSClass;
GType e_mail_formatter_evolution_rss_get_type (void);
-static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface);
-static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+
+G_DEFINE_DYNAMIC_TYPE (
EMailFormatterRSS,
e_mail_formatter_evolution_rss,
- E_TYPE_EXTENSION,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_EXTENSION,
- e_mail_formatter_mail_extension_interface_init)
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_FORMATTER_EXTENSION,
- e_mail_formatter_formatter_extension_interface_init));
+ E_TYPE_MAIL_FORMATTER_EXTENSION)
+
+static const gchar* rss_formatter_mime_types[] = { "x-evolution/evolution-rss-feed", NULL };
+
+static void
+set_view_cb (GtkWidget *button,
+ gpointer *data)
+{
+ rss_set_current_view(rss_get_current_view()^1);
+ rss_set_changed_view(1);
+ e_mail_display_reload (rss_get_display());
+}
+#include "fetch.h"
+
+typedef struct _HD HD;
+struct _HD {
+ gchar *website;
+ gchar *content;
+ gchar *current_html;
+ EMailFormatter *formatter;
+ gchar *header;
+ CamelStream *stream;
+};
-static const gchar* formatter_mime_types[] = { "application/vnd.evolution.attachment" , NULL };
+gboolean
+feed_async(gpointer key)
+{
+ HD *hd = (HD *)key;
+ e_mail_display_load_images(rss_get_display());
+ //gchar *header = e_mail_formatter_get_html_header (hd->formatter);
+ //camel_stream_write_string (hd->stream, header, NULL, NULL);
+ gchar *result = g_strconcat(hd->header,
+ "www</body></html>", NULL);
+ //NULL);
+ g_print("header:%s\n", result);
+ e_web_view_load_string (E_WEB_VIEW (rss_get_display()), hd->content);
+ return FALSE;
+}
static gboolean
emfe_evolution_rss_format (EMailFormatterExtension *extension,
@@ -79,6 +99,13 @@ emfe_evolution_rss_format (EMailFormatterExtension *extension,
gchar *str;
GByteArray *ba;
gchar *src;
+ CamelMimePart *message = (CamelMimePart *)part->part;
+ gchar *website, *subject, *category, *feedid, *comments;
+ guint32 frame_col, cont_col, text_col;
+ gboolean is_html = NULL;
+ gchar *feed_dir, *tmp_file, *tmp_path, *iconfile;
+ GdkPixbuf *pixbuf;
+ g_print("in formatter\n");
CamelContentType *ct = camel_mime_part_get_content_type (part->part);
if (ct) {
@@ -92,89 +119,167 @@ emfe_evolution_rss_format (EMailFormatterExtension *extension,
}
str = g_strdup_printf (
- "<div class=\"part-container\" style=\"border-color: #%06x; "
- "background-color: #%06x; color: #%06x;\">"
- "<div class=\"part-container-inner-margin\">\n",
- e_color_to_value ((GdkColor *)
- e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_FRAME)),
- e_color_to_value ((GdkColor *)
- e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_CONTENT)),
- e_color_to_value ((GdkColor *)
- e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_TEXT)));
-
+ "<object type=\"application/vnd.evolution.attachment\" "
+ "height=\"0\" width=\"100%%\" data=\"%s\" id=\"%s\"></object>",
+ part->id, part->id);
camel_stream_write_string (
stream, str, cancellable, NULL);
+ gchar *h = g_strdup(e_web_view_get_html (E_WEB_VIEW (rss_get_display())));
+ g_print("h:%s\n\n\n\n", h);
+
+ website = camel_medium_get_header (
+ CAMEL_MEDIUM (message), "Website");
+ feedid = (gchar *)camel_medium_get_header(
+ CAMEL_MEDIUM(message), "RSS-ID");
+ comments = (gchar *)camel_medium_get_header (
+ CAMEL_MEDIUM(message),
+ "X-Evolution-rss-comments");
+ if (comments)
+ comments = g_strstrip(comments);
+ category = (gchar *)camel_medium_get_header(
+ CAMEL_MEDIUM(message),
+ "X-Evolution-rss-category");
+ subject = camel_header_decode_string(
+ camel_medium_get_header (CAMEL_MEDIUM (message),
+ "Subject"), NULL);
+
+ if (feedid)
+ is_html = rss_get_is_html(feedid);
+
+ if (!rss_get_changed_view())
+ rss_set_current_view(is_html);
+ else
+ rss_set_changed_view(0);
+
+
+ feed_dir = rss_component_peek_base_directory();
+ tmp_file = g_strconcat(feedid, ".img", NULL);
+ tmp_path = g_build_path(G_DIR_SEPARATOR_S,
+ feed_dir, tmp_file, NULL);
+ g_free(tmp_file);
+ g_free(feed_dir);
+ iconfile = g_strconcat("evo-file://", tmp_path, NULL);
+ if (g_file_test(tmp_path, G_FILE_TEST_EXISTS)){
+ if (!(pixbuf = gdk_pixbuf_new_from_file(tmp_path, NULL))) {
+ tmp_file = g_build_filename (EVOLUTION_ICONDIR, "rss-16.png", NULL);
+ iconfile = g_strconcat("evo-file://", tmp_file, NULL);
+ g_free(tmp_file);
+ }
+ }
- decoded_stream = camel_stream_mem_new ();
-
- e_mail_formatter_format_text (
- formatter, part, decoded_stream, cancellable);
-
- g_seekable_seek (G_SEEKABLE (decoded_stream), 0, G_SEEK_SET, cancellable, NULL);
-
- ba = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (decoded_stream));
- src = rss_process_feed((gchar *)ba->data, ba->len);
-
- camel_stream_write_string(stream, src, cancellable, NULL);
- g_free(src);
- g_object_unref (decoded_stream);
-
- camel_stream_write_string (
- stream, "</div></div>", cancellable, NULL);
+ frame_col = e_color_to_value ((GdkColor *)
+ e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_FRAME));
+ cont_col = e_color_to_value ((GdkColor *)
+ e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_CONTENT));
+ text_col = e_color_to_value ((GdkColor *)
+ e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_TEXT));
+
+ if (!is_html && !rss_get_current_view()) {
+ str = g_strdup_printf (
+ "<div class=\"part-container\" style=\"border-color: #%06x; "
+ "background-color: #%06x; color: #%06x;\">"
+ "<div class=\"part-container-inner-margin\">\n"
+ "<div style=\"border: solid 0px; background-color: #%06x; padding: 0px; spacing: 1px; color: #%06x;\">"
+ " <img height=13 src=%s> "
+ "<b><font size=+1><a href=%s>%s</a></font></b></div>",
+ frame_col,
+ cont_col,
+ text_col,
+ cont_col & 0xEDECEB & 0xffffff,
+ text_col & 0xffffff,
+ iconfile, website, subject);
+
+ camel_stream_write_string (
+ stream, str, cancellable, NULL);
+
+ decoded_stream = camel_stream_mem_new ();
+
+ e_mail_formatter_format_text (
+ formatter, part, decoded_stream, cancellable);
+
+ g_seekable_seek (G_SEEKABLE (decoded_stream), 0, G_SEEK_SET, cancellable, NULL);
+
+ ba = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (decoded_stream));
+ src = rss_process_feed((gchar *)ba->data, ba->len);
+
+ camel_stream_write_string(stream, src, cancellable, NULL);
+ g_free(src);
+ g_object_unref (decoded_stream);
+
+ camel_stream_write_string (
+ stream, "</div></div>", cancellable, NULL);
+ } else {
+ GError *err = NULL;
+ gchar *str;
+ HD *hd = g_malloc0(sizeof(*hd));
+ hd->current_html = h;
+ hd->formatter = formatter;
+ hd->header = e_mail_formatter_get_html_header(formatter);
+ hd->stream = stream;
+ GString *content = fetch_blocking(website, NULL, NULL, textcb, NULL, &err);
+ if (err) {
+ //we do not need to setup a pop error menu since we're in
+ //formatting process. But instead display mail body an error
+ //such proxy error or transport error
+ str = g_strdup_printf (
+ "<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n",
+ frame_col & 0xffffff,
+ cont_col & 0xffffff,
+ text_col & 0xffffff);
+ camel_stream_write_string (stream, str, cancellable, NULL);
+ g_free (str);
+ camel_stream_write_string (stream, "<div style=\"border: solid 0px; padding: 4px;\">\n", cancellable, NULL);
+ camel_stream_write_string (stream, "<h3>Error!</h3>", cancellable, NULL);
+ camel_stream_write_string (stream, err->message, cancellable, NULL);
+ camel_stream_write_string (stream, "</div>", cancellable, NULL);
+ return TRUE;
+ }
+
+ gchar *buff = rss_process_website(content->str, website);
+ hd->content = buff;
+
+ /* str = g_strdup_printf (
+ "<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n",
+ frame_col & 0xffffff,
+ cont_col & 0xffffff,
+ text_col & 0xffffff);
+ camel_stream_write_string (stream, str, NULL, NULL);
+ g_free (str);
+ str = g_strdup_printf (
+ "<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
+ "<b><font size=+1><a href=%s>%s</a></font></b></div>",
+ cont_col & 0xEDECEB & 0xffffff,
+ text_col & 0xffffff,
+ website, subject);
+ camel_stream_write_string (stream, str, NULL, NULL);
+ if (category) {
+ str = g_strdup_printf (
+ "<div style=\"border: solid 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
+ "<b><font size=-1>%s: %s</font></b></div>",
+ cont_col & 0xEDECEB & 0xffffff,
+ text_col & 0xffffff,
+ _("Posted under"), category);
+ camel_stream_write_string (stream, str, NULL, NULL);
+ g_free (str);
+ }
+
+ str = g_strdup_printf (
+ "<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 2px; color: #%06x;\">"
+ "%s</div></div>",
+ frame_col & 0xffffff,
+ cont_col & 0xffffff,
+ text_col & 0xffffff,
+ buff);
+ camel_stream_write_string (stream, buff, NULL, NULL);*/
+// g_free (str);
+ g_idle_add((GSourceFunc)feed_async, hd);
+ }
return TRUE;
}
-static const gchar *
-emfe_evolution_rss_get_display_name (EMailFormatterExtension *extension)
-{
- return _("Evolution-RSS");
-}
-
-static const gchar *
-emfe_evolution_rss_get_description (EMailFormatterExtension *extension)
-{
- return _("Displaying RSS feed arcticles");
-}
-
-static const gchar **
-emfe_evolution_rss_mime_types (EMailExtension *extension)
-{
- return formatter_mime_types;
-}
-
-static void
-e_mail_formatter_evolution_rss_init (EMailFormatterRSS *object)
-{
-}
-
-static void
-e_mail_formatter_evolution_rss_constructed (GObject *object)
-{
- EExtensible *extensible;
- EMailExtensionRegistry *reg;
-
- extensible = e_extension_get_extensible (E_EXTENSION (object));
- reg = E_MAIL_EXTENSION_REGISTRY (extensible);
-
- e_mail_extension_registry_add_extension (reg, E_MAIL_EXTENSION (object));
-}
-
static void
-e_mail_formatter_evolution_rss_class_init (EMailFormatterRSSClass *class)
-{
- GObjectClass *object_class;
- EExtensionClass *extension_class;
-
- object_class = G_OBJECT_CLASS (class);
- object_class->constructed = e_mail_formatter_evolution_rss_constructed;
-
- extension_class = E_EXTENSION_CLASS (class);
- extension_class->extensible_type = E_TYPE_MAIL_FORMATTER_EXTENSION_REGISTRY;
-}
-
-static void
-e_mail_formatter_evolution_rss_class_finalize (EMailFormatterRSSClass *class)
+e_mail_formatter_evolution_rss_init (EMailFormatterExtension *object)
{
}
@@ -184,17 +289,43 @@ e_mail_formatter_evolution_rss_type_register (GTypeModule *type_module)
e_mail_formatter_evolution_rss_register_type (type_module);
}
+static GtkWidget *
+emfe_evolution_rss_get_widget (EMailFormatterExtension *extension,
+ EMailPartList *context,
+ EMailPart *part,
+ GHashTable *params)
+{
+ GtkWidget *box, *button;
+ box = gtk_hbutton_box_new ();
+
+ button = gtk_button_new_with_label (rss_get_current_view() ? _("Show Summary") :
+ _("Show Full Text"));
+ g_signal_connect (button, "clicked", set_view_cb, NULL);
+
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
+ button = gtk_button_new_with_label (rss_get_current_view() ? _("Show Summary") :
+ _("Show Full Text"));
+ g_signal_connect (button, "clicked", set_view_cb, NULL);
+
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (box), button, TRUE, TRUE, 0);
+ gtk_widget_show(box);
+ return box;
+}
+
static void
-e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface)
+e_mail_formatter_evolution_rss_class_init (EMailFormatterExtensionClass *class)
{
- iface->format = emfe_evolution_rss_format;
- iface->get_display_name = emfe_evolution_rss_get_display_name;
- iface->get_description = emfe_evolution_rss_get_description;
+ class->mime_types = rss_formatter_mime_types;
+ class->format = emfe_evolution_rss_format;
+ class->get_widget = emfe_evolution_rss_get_widget;
+ class->display_name = _("Evolution-RSS");
+ class->description = _("Displaying RSS feed arcticles");
}
static void
-e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface)
+e_mail_formatter_evolution_rss_class_finalize (EMailFormatterRSSClass *class)
{
- iface->mime_types = emfe_evolution_rss_mime_types;
}
diff --git a/src/e-mail-parser-evolution-rss.c b/src/e-mail-parser-evolution-rss.c
index 820a077..c815326 100644
--- a/src/e-mail-parser-evolution-rss.c
+++ b/src/e-mail-parser-evolution-rss.c
@@ -32,102 +32,71 @@
#include <libebackend/libebackend.h>
-typedef struct _EMailParserRSS {
- EExtension parent;
-} EMailParserRSS;
-
-typedef struct _EMailParserRSSClass {
- EExtensionClass parent_class;
-} EMailParserRSSClass;
+typedef EMailParserExtension EMailParserRSS;
+typedef EMailParserExtensionClass EMailParserRSSClass;
GType e_mail_parser_evolution_rss_get_type (void);
-static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserRSS,
e_mail_parser_evolution_rss,
- E_TYPE_EXTENSION,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_EXTENSION,
- e_mail_parser_mail_extension_interface_init)
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
static const gchar* pser_mime_types[] = { "x-evolution/evolution-rss-feed", NULL };
-static GSList *
+typedef struct _EMailPartRSS EMailPartRSS;
+
+struct _EMailPartRSS {
+ EMailPart parent;
+};
+
+static gboolean
empe_evolution_rss_parse (EMailParserExtension *extension,
EMailParser *parser,
CamelMimePart *part,
GString *part_id,
- GCancellable *cancellable)
+ GCancellable *cancellable,
+ GQueue *out_mail_queue)
{
- GSList *parts = e_mail_parser_parse_part_as (
- parser, part, part_id, "application/vnd.evolution.attachment", cancellable);
+ EMailPartRSS *mail_part;
+ GQueue work_queue = G_QUEUE_INIT;
+ gint len;
- return parts;
-}
+ len = part_id->len;
-static const gchar **
-empe_rss_mime_types (EMailExtension *extension)
-{
- return pser_mime_types;
-}
+ mail_part = (EMailPartRSS *) e_mail_part_subclass_new (
+ part, part_id->str, sizeof (EMailPartRSS),
+ NULL);
+ mail_part->parent.mime_type = camel_content_type_simple (
+ camel_mime_part_get_content_type (part));
+ g_string_truncate (part_id, len);
-void
-e_mail_parser_evolution_rss_type_register (GTypeModule *type_module)
-{
- e_mail_parser_evolution_rss_register_type (type_module);
-}
+ g_queue_push_tail (&work_queue, mail_part);
+ e_queue_transfer (&work_queue, out_mail_queue);
-static void
-e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface)
-{
- iface->mime_types = empe_rss_mime_types;
+ return TRUE;
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
+e_mail_parser_evolution_rss_class_init (EMailParserExtensionClass *class)
{
- iface->parse = empe_evolution_rss_parse;
+ class->mime_types = pser_mime_types;
+ class->parse = empe_evolution_rss_parse;
}
-static void
-e_mail_parser_evolution_rss_constructed (GObject *object)
+void
+e_mail_parser_evolution_rss_class_finalize (EMailParserExtensionClass *class)
{
- EExtensible *extensible;
- EMailExtensionRegistry *reg;
-
- extensible = e_extension_get_extensible (E_EXTENSION (object));
- reg = E_MAIL_EXTENSION_REGISTRY (extensible);
-
- e_mail_extension_registry_add_extension (reg, E_MAIL_EXTENSION (object));
}
static void
-e_mail_parser_evolution_rss_class_init (EMailParserRSSClass *class)
+e_mail_parser_evolution_rss_init (EMailParserExtension *parser)
{
- GObjectClass *object_class;
- EExtensionClass *extension_class;
- object_class = G_OBJECT_CLASS (class);
- object_class->constructed = e_mail_parser_evolution_rss_constructed;
-
- extension_class = E_EXTENSION_CLASS (class);
- extension_class->extensible_type = E_TYPE_MAIL_PARSER_EXTENSION_REGISTRY;
}
void
-e_mail_parser_evolution_rss_class_finalize (EMailParserRSSClass *class)
-{
-}
-
-static void
-e_mail_parser_evolution_rss_init (EMailParserRSS *parser)
+e_mail_parser_evolution_rss_type_register (GTypeModule *type_module)
{
-
+ e_mail_parser_evolution_rss_register_type (type_module);
}
-
diff --git a/src/misc.c b/src/misc.c
index 430bf4c..5ba90ac 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -664,5 +664,23 @@ sanitize_path_separator(gchar *str)
#endif
}
+void
+textcb(NetStatusType status, gpointer statusdata, gpointer data)
+{
+ NetStatusProgress *progress;
+ float fraction = 0;
+ switch (status) {
+ case NET_STATUS_PROGRESS:
+ progress = (NetStatusProgress*)statusdata;
+ if (progress->current > 0 && progress->total > 0) {
+ fraction = (float)progress->current / progress->total;
+ d("%.2f%% ", fraction);
+ }
+ break;
+ default:
+ g_warning("unhandled network status %d\n", status);
+ }
+}
+
#endif
diff --git a/src/misc.h b/src/misc.h
index 273ff59..3503513 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -52,5 +52,6 @@ void feed_remove_status_line(gchar *file_name, gchar *needle);
void write_feed_status_line(gchar *file, gchar *needle);
void dup_auth_data(gchar *origurl, gchar *url);
void sanitize_path_separator(gchar *);
+void textcb(NetStatusType status, gpointer statusdata, gpointer data);
#endif
diff --git a/src/network-soup.c b/src/network-soup.c
index eaf69a4..becf27e 100644
--- a/src/network-soup.c
+++ b/src/network-soup.c
@@ -46,6 +46,7 @@ extern int rss_verbose_debug;
#include "network.h"
#include "network-soup.h"
#include "rss.h"
+#include "rss-formatter.h"
#include "misc.h"
#define USE_PROXY FALSE
diff --git a/src/parser.c b/src/parser.c
index e04cf13..d3b3ed6 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -57,6 +57,7 @@ extern int rss_verbose_debug;
#include "fetch.h"
#include "rss.h"
#include "rss-config.h"
+#include "rss-formatter.h"
#include "rss-image.h"
#include "rss-status-icon.h"
#include "parser.h"
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index d7a6854..d4e40c0 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -77,6 +77,7 @@ extern int rss_verbose_debug;
extern EShellView *rss_shell_view;
#include "rss.h"
+#include "rss-formatter.h"
#include "misc.h"
#include "parser.h"
#include "rss-config.h"
diff --git a/src/rss-config.c b/src/rss-config.c
index 4017399..e214f5c 100644
--- a/src/rss-config.c
+++ b/src/rss-config.c
@@ -28,6 +28,7 @@
#include "misc.h"
#include "rss-config.h"
+#include "rss-formatter.h"
extern rssfeed *rf;
diff --git a/src/rss-formatter.c b/src/rss-formatter.c
index 2074578..fda3488 100644
--- a/src/rss-formatter.c
+++ b/src/rss-formatter.c
@@ -32,6 +32,7 @@
extern int rss_verbose_debug;
extern EShellView *rss_shell_view;
+extern rssfeed *rf;
gchar *
rss_process_feed(gchar *feed, guint len)
@@ -111,3 +112,71 @@ pixdone: g_free(real_image);
return result;
}
+#include <libxml/HTMLtree.h>
+#include <string.h>
+
+gchar *
+rss_process_website(gchar *content, gchar *website)
+{
+ gchar *tmp = decode_utf8_entities(content);
+ xmlDoc *src = (xmlDoc *)parse_html(website, tmp, strlen(tmp));
+ xmlChar *buff = NULL;
+ int size;
+
+ if (src) {
+ htmlDocDumpMemory(src, &buff, &size);
+ d("htmlDocDumpMemory:%s\n", buff);
+ xmlFree(src);
+ return buff;
+ }
+ return NULL;
+}
+
+gboolean
+rss_get_current_view(void)
+{
+ return rf->cur_format;
+}
+
+void
+rss_set_current_view(gboolean value)
+{
+ rf->cur_format = value;
+}
+
+gboolean
+rss_get_changed_view(void)
+{
+ return rf->chg_format;
+}
+
+void
+rss_set_changed_view(gboolean value)
+{
+ rf->chg_format = value;
+}
+
+gboolean
+rss_get_is_html(gchar *feedid)
+{
+ return g_hash_table_lookup(rf->hrh, feedid); //feedid is modified
+}
+
+EMailDisplay *
+rss_get_display(void)
+{
+ EMailReader *reader;
+ EShellContent *shell_content;
+
+ shell_content = e_shell_view_get_shell_content (rss_shell_view);
+ reader = E_MAIL_READER (shell_content);
+ return e_mail_reader_get_mail_display (reader);
+}
+
+gchar *
+rss_component_peek_base_directory(void)
+{
+ return g_strdup_printf("%s" G_DIR_SEPARATOR_S "rss",
+ mail_session_get_data_dir ());
+}
+
diff --git a/src/rss-formatter.h b/src/rss-formatter.h
index 78ae6f0..6a2fcf3 100644
--- a/src/rss-formatter.h
+++ b/src/rss-formatter.h
@@ -20,9 +20,19 @@
#ifndef __RSS_FORMATTER_H_
#define __RSS_FORMATTER_H_
+#include <mail/e-mail-reader-utils.h>
+
#include "debug.h"
gchar *rss_process_feed(gchar *feed, guint len);
+gchar *rss_process_website(gchar *content, gchar *website);
+gboolean rss_get_current_view(void);
+void rss_set_current_view(gboolean value);
+gchar *rss_component_peek_base_directory(void);
+gboolean rss_get_changed_view(void);
+void rss_set_changed_view(gboolean value);
+gboolean rss_get_is_html(gchar *feedid);
+EMailDisplay *rss_get_display(void);
#endif /*__RSS_FORMATTER_H_*/
diff --git a/src/rss-image.c b/src/rss-image.c
index df308b1..5169cb2 100644
--- a/src/rss-image.c
+++ b/src/rss-image.c
@@ -46,6 +46,7 @@ extern int rss_verbose_debug;
#include "rss.h"
#include "rss-cache.h"
#include "rss-config.h"
+#include "rss-formatter.h"
#include "rss-image.h"
#include "rss-icon-factory.h"
diff --git a/src/rss.c b/src/rss.c
index f08bbf1..1fa99cf 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -165,6 +165,7 @@ int rss_verbose_debug = 0;
#include "rss.h"
#include "rss-config.h"
#include "rss-cache.h"
+#include "rss-formatter.h"
#include "rss-image.h"
#include "parser.h"
#include "network-soup.h"
@@ -491,6 +492,7 @@ update_progress_bar(guint current)
}
+#if 0
void
textcb(NetStatusType status, gpointer statusdata, gpointer data)
{
@@ -508,6 +510,7 @@ textcb(NetStatusType status, gpointer statusdata, gpointer data)
g_warning("unhandled network status %d\n", status);
}
}
+#endif
void
download_chunk(
@@ -2628,13 +2631,6 @@ update_articles(gboolean disabler)
return disabler;
}
-gchar *
-rss_component_peek_base_directory(void)
-{
- return g_strdup_printf("%s" G_DIR_SEPARATOR_S "rss",
- mail_session_get_data_dir ());
-}
-
CamelStore *
rss_component_peek_local_store(void)
{
diff --git a/src/rss.h b/src/rss.h
index 1f4d458..18ecb55 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -490,10 +490,7 @@ finish_feed (
gpointer user_data);
#endif
void generic_finish_feed(rfMessage *msg, gpointer user_data);
-void textcb(
- NetStatusType status,
- gpointer statusdata,
- gpointer data);
+//void textcb(NetStatusType status, gpointer statusdata, gpointer data);
void download_chunk(
NetStatusType status,
@@ -514,7 +511,6 @@ void populate_reversed(
gpointer key,
gpointer value,
GHashTable *hash);
-gchar *rss_component_peek_base_directory(void);
CamelStore *rss_component_peek_local_store(void);
void custom_feed_timeout(void);
CamelFolder *check_feed_folder(gchar *folder_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]