[evolution-rss] move prototypes to header files, add missing headers,



commit 4e6baefaac8a63e9093b5b4ec0a20c76e5014b37
Author: Lucian Langa <lucilanga gnome org>
Date:   Thu May 7 23:55:07 2009 +0300

    move prototypes to header files, add missing headers,
            cleanup variables
---
 ChangeLog          |   15 +++++++++++++++
 src/Makefile.am    |    1 +
 src/Makefile.in    |   12 +++++++-----
 src/dbus.c         |    1 -
 src/fetch.c        |    1 +
 src/misc.c         |    6 +++---
 src/misc.h         |    3 +++
 src/network-soup.c |   30 +++++++++++++++---------------
 src/network-soup.h |   42 ++++++++++++++++++++++++++++++++++++++++++
 src/network.h      |    2 +-
 src/parser.c       |   51 +--------------------------------------------------
 src/rss.c          |   40 ++++++++++++++++++----------------------
 src/rss.h          |    2 ++
 13 files changed, 109 insertions(+), 97 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e0473d3..ea1ced1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-05-07  Lucian Langa  <lucilanga gnome org>
+
+	* src/dbus.c (filter_function):
+	* src/fetch.c:
+	* src/misc.c:
+	* src/misc.h:
+	* src/network-soup.c:
+	* src/network-soup.h:
+	* src/network.h:
+	* src/parser.c (layer_find_tag_prop), (update_channel):
+	* src/rss.c (timeout_soup), (gecko_click), (setup_feed),
+	(store_folder_renamed):
+	* src/rss.h: move prototypes to header files, add missing headers,
+	cleanup variables
+
 2009-05-06  Lucian Langa  <lucilanga gnome org>
 
 	* src/gecko-utils.cpp:
diff --git a/src/Makefile.am b/src/Makefile.am
index ac8416a..c208d6c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,6 +71,7 @@ plugin_LTLIBRARIES = liborg-gnome-evolution-rss.la
 
 SOURCES = 	dbus.c			\
 	  	misc.c			\
+		network-soup.c		\
 		rss.c			\
 		rss-config-factory.c
 if HAVE_GECKO
diff --git a/src/Makefile.in b/src/Makefile.in
index ce92ae1..83e6c0e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -63,11 +63,11 @@ am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(bindir)" \
 pluginLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 liborg_gnome_evolution_rss_la_LIBADD =
-am__liborg_gnome_evolution_rss_la_SOURCES_DIST = dbus.c misc.c rss.c \
-	rss-config-factory.c gecko-utils.cpp
+am__liborg_gnome_evolution_rss_la_SOURCES_DIST = dbus.c misc.c \
+	network-soup.c rss.c rss-config-factory.c gecko-utils.cpp
 @HAVE_GECKO_TRUE am__objects_1 = gecko-utils.lo
-am__objects_2 = dbus.lo misc.lo rss.lo rss-config-factory.lo \
-	$(am__objects_1)
+am__objects_2 = dbus.lo misc.lo network-soup.lo rss.lo \
+	rss-config-factory.lo $(am__objects_1)
 am_liborg_gnome_evolution_rss_la_OBJECTS = $(am__objects_2)
 liborg_gnome_evolution_rss_la_OBJECTS =  \
 	$(am_liborg_gnome_evolution_rss_la_OBJECTS)
@@ -348,7 +348,8 @@ plugin_DATA = org-gnome-evolution-rss.eplug \
 	org-gnome-evolution-rss.xml
 
 plugin_LTLIBRARIES = liborg-gnome-evolution-rss.la
-SOURCES = dbus.c misc.c rss.c rss-config-factory.c $(am__append_2)
+SOURCES = dbus.c misc.c network-soup.c rss.c rss-config-factory.c \
+	$(am__append_2)
 liborg_gnome_evolution_rss_la_SOURCES = $(SOURCES)
 liborg_gnome_evolution_rss_la_LDFLAGS = -module -avoid-version $(WEBKIT_LIBS) $(GECKO_LIBS) $(LIBSOUP_LIBS) $(NO_UNDEFINED_LIBS) $(NO_UNDEFINED)
 #$(GECKO_RPATH)
@@ -504,6 +505,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/evolution-import-rss Po am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/gecko-utils Plo am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/misc Plo am__quote@
+ AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/network-soup Plo am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/rss-config-factory Plo am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote  /$(DEPDIR)/rss Plo am__quote@
 
diff --git a/src/dbus.c b/src/dbus.c
index dcd5926..8346523 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -144,7 +144,6 @@ filter_function (DBusConnection *connection, DBusMessage *message, void *user_da
     		return DBUS_HANDLER_RESULT_HANDLED;
   	}
 	else if (dbus_message_is_signal (message, DBUS_INTERFACE, "ping")) {
-		gchar *data = g_strdup("PONG");
 		DBusMessage *reply;
 		fprintf(stderr, "!!Ping!! received from %s\n",
 				dbus_message_get_sender(message));
diff --git a/src/fetch.c b/src/fetch.c
index 12b4a11..0dc2db8 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -21,6 +21,7 @@
 #include "network.h"
 #include "rss.h"
 #include "file-gio.h"
+#include "network-soup.h"
 
 GString*
 fetch_blocking(gchar *url, GSList *headers, GString *post,
diff --git a/src/misc.c b/src/misc.c
index f34ee18..80a7460 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -150,7 +150,7 @@ sanitize_folder(gchar *text)
         return string;
 }
  
-static gchar *
+gchar *
 get_url_basename(gchar *url)
 {
 	gchar *p;
@@ -316,7 +316,7 @@ gen_md5(gchar *buffer)
          return g_strdup((gchar *)res);
 }
 
-static void
+void
 header_decode_lwsp(const char **in)
 {
         const char *inptr = *in;
@@ -347,7 +347,7 @@ header_decode_lwsp(const char **in)
         *in = inptr;
 }
 
-static char *
+char *
 decode_token (const char **in)
 {
         const char *inptr = *in;
diff --git a/src/misc.h b/src/misc.h
index 57f1ccb..bcfb856 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -26,10 +26,13 @@ gchar *markup_decode (gchar *str);
 gboolean check_if_match (gpointer key, gpointer value, gpointer user_data);
 gchar *get_server_from_uri(gchar *uri);
 gchar *get_port_from_uri(gchar *uri);
+gchar *get_url_basename(gchar *url);
 gboolean is_rfc822(char *in);
 gchar *extract_main_folder(gchar *folder);
 gchar *strextr(gchar *text, gchar *substr);
 gchar *sanitize_url(gchar *text);
 gchar *sanitize_folder(gchar *text);
+void header_decode_lwsp(const char **in);
+char *decode_token (const char **in);
 
 #endif
diff --git a/src/network-soup.c b/src/network-soup.c
index a9fdab6..74bdcf7 100644
--- a/src/network-soup.c
+++ b/src/network-soup.c
@@ -1,5 +1,5 @@
 /*  Evolution RSS Reader Plugin
- *  Copyright (C) 2007-2008 Lucian Langa <cooly gnome eu org>
+ *  Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org>
  *         
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -18,23 +18,31 @@
  * vim: tabstop=4 shiftwidth=4 noexpandtab :
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <string.h>
-//#include <libsoup/soup-gnome.h>
+#include <gconf/gconf-client.h>
 #include <libedataserver/e-proxy.h>
 
 #include "network.h"
+#include "network-soup.h"
 #include "rss.h"
 #include "misc.h"
 
+
 #define USE_PROXY FALSE
 
 #define SS_TIMEOUT 30
 
+#define d(x)
+
 gint proxy_type = 0;
 extern rssfeed *rf;
 extern GConfClient *rss_gconf;
+extern SoupSession *webkit_session;
 EProxy *proxy;
-SoupSession *webkit_session = NULL;
 
 typedef struct {
 	NetStatusCallback user_cb;
@@ -104,20 +112,17 @@ got_chunk_cb(SoupMessage *msg, SoupBuffer *chunk, CallbackInfo *info) {
 #else
 	info->current += chunk->length;
 #endif
-	info->chunk = chunk->data;
+	info->chunk = (gchar *)chunk->data;
 	progress = g_new0(NetStatusProgress, 1);
 
 	progress->current = info->current;
 	progress->total = info->total;
-	progress->chunk = chunk->data;
-	progress->chunksize = chunk->length;
+	progress->chunk = (gchar *)chunk->data;
+	progress->chunksize = (gint)chunk->length;
 	info->user_cb(NET_STATUS_PROGRESS, progress, info->user_data);
 	g_free(progress);
 }
 
-int net_error_quark(void);
-#define NET_ERROR net_error_quark()
-
 int net_error_quark(void)
 {
 	return 0;
@@ -171,11 +176,7 @@ unblock_free (gpointer user_data, GObject *ex_msg)
 	g_hash_table_find(rf->key_session,
 		remove_if_match,
 		user_data);
-	gboolean prune = soup_session_try_prune_connection (user_data);
-	//I really don't know if his is necesarry
-	//but I believe it won't hurt
-	if (prune)
-		g_object_unref(user_data);
+	soup_session_abort (user_data);
 }
 
 EProxy *
@@ -554,7 +555,6 @@ soup_message_add_header_handler (msg,
 	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
-		g_print("connected for %s\n", url);
 	}
 
 	soup_session_queue_message (soup_sess, msg,
diff --git a/src/network-soup.h b/src/network-soup.h
index f2215d4..0407b32 100644
--- a/src/network-soup.h
+++ b/src/network-soup.h
@@ -1,3 +1,45 @@
+/*  Evolution RSS Reader Plugin
+ *  Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org>
+ *         
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or 
+ *  (at your option) any later version.
+ *                     
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *                                             
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * vim: tabstop=4 shiftwidth=4 noexpandtab :
+ */
+
+
+#include <libedataserver/e-proxy.h>
 
 void abort_all_soup(void);
 gboolean cancel_soup_sess(gpointer key, gpointer value, gpointer user_data);
+gboolean net_get_unblocking(gchar *url,
+                                NetStatusCallback cb, gpointer data,
+                                gpointer cb2, gpointer cbdata2,
+                                guint track,
+                                GError **err);
+
+GString *net_post_blocking(gchar *url, GSList *headers, GString *post,
+                  NetStatusCallback cb, gpointer data,
+                  GError **err);
+
+#define NET_ERROR net_error_quark()
+int net_error_quark(void);
+
+void proxify_webkit_session(EProxy *proxy, gchar *uri);
+void proxify_session(EProxy *proxy, SoupSession *session, gchar *uri);
+
+guint save_up(gpointer data);
+guint del_up(gpointer data);
+void rss_soup_init(void);
+EProxy *proxy_init(void);
diff --git a/src/network.h b/src/network.h
index ee4473e..5a660be 100644
--- a/src/network.h
+++ b/src/network.h
@@ -107,7 +107,7 @@ typedef struct {
     guint32 current;
     guint32 total;
     gchar *chunk;
-    gchar *chunksize;
+    guint chunksize;
 } NetStatusProgress;
 
 typedef void (*NetStatusCallback)(NetStatusType status,
diff --git a/src/parser.c b/src/parser.c
index 215b12d..5327b9c 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -23,6 +23,7 @@
 
 guint rsserror = FALSE;
 gchar *rssstrerror = NULL;
+extern rssfeed *rf;
 
 void
 html_set_base(xmlNode *doc, char *base, char *tag, char *prop, char *basehref)
@@ -245,51 +246,6 @@ parse_html(char *url, const char *html, int len)
         return doc;
 }
 
-static gchar *
-parse_href (const gchar *s, const gchar *base)
-{
-        gchar *tmpurl;
-
-        if(s == NULL || *s == 0)
-                return g_strdup ("");
-
-//      tmpurl = html_url_new (s);
-//        if (html_url_get_protocol (tmpurl) == NULL) {
-                if (s[0] == '/') {
-                        if (s[1] == '/') {
-                                gchar *t;
-
-                                /* Double slash at the beginning.  */
-
-                                /* FIXME?  This is a bit sucky.  */
-/*                                t = g_strconcat (html_url_get_protocol (baseURL),
-                                                 ":", s, NULL);
-                                html_url_destroy (tmpurl);
-                                tmpurl = html_url_new (t);
-                                retval = html_url_to_string (tmpurl);
-                                html_url_destroy (tmpurl);
-                                g_free (t);*/
-                        } else {
-                                /* Single slash at the beginning.  */
-
-                                tmpurl = g_strdup_printf("%s%s", base, s);
-                        }
-                } else {
-                                gchar *t;
-/*                        html_url_destroy (tmpurl);
-                        tmpurl = html_url_append_path (baseURL, s);
-                        retval = html_url_to_string (tmpurl);
-                        html_url_destroy (tmpurl);*/
-                }
-//        } else {
-  //              retval = html_url_to_string (tmpurl);
-    //            html_url_destroy (tmpurl);
-      //  }
-
-        return tmpurl;
-}
-
-
 static char *
 layer_find_innerelement (xmlNodePtr node, 
 	    char *match, char *el,
@@ -572,8 +528,6 @@ layer_find_tag_prop (xmlNodePtr node,
             char *search,
             char *fail)
 {
-	gchar *content;
-	guint len = 0;
 	int i;
 	char* (*func)();
 
@@ -1031,10 +985,7 @@ update_channel(RDF *r)
 {
         guint i;
 	gchar *sender;
-	char *d2 = NULL;
 	xmlNodePtr el;
-	char *q = NULL;
-	char *b = NULL;
 	gchar *subj;
 	create_feed *CF;
 	CamelFolder *mail_folder;
diff --git a/src/rss.c b/src/rss.c
index 7e9c60f..1811cb1 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -17,7 +17,6 @@
  */
 
 #ifdef HAVE_CONFIG_H
-
 #include "config.h"
 #endif
 
@@ -29,22 +28,23 @@ int rss_verbose_debug = 0;
 #include <stdio.h>
 #include <ctype.h>
 #include <time.h>
+#include <errno.h>
 
 #include <camel/camel-mime-message.h>
 #include <camel/camel-folder.h>
-#include <camel/camel-exception.h>
+//#include <camel/camel-exception.h>
 #include <camel/camel-multipart.h>
 #include <camel/camel-stream-mem.h>
 #include <camel/camel-stream-fs.h>
 #include <camel/camel-text-index.h>
 
-#include <mail/em-popup.h>
+//#include <mail/em-popup.h>
 #include <e-util/e-error.h>
 #include <e-util/e-icon-factory.h>
 #include <e-util/e-mktemp.h>
 #include <e-util/e-util.h>
 
-#include <mail/em-config.h>
+//#include <mail/em-config.h>
 
 #ifdef EVOLUTION_2_12
 #include <mail/em-event.h>
@@ -52,19 +52,18 @@ int rss_verbose_debug = 0;
 
 #include <mail/em-utils.h>
 #include <mail/em-folder-tree.h>
-#include <mail/em-folder-tree-model.h>
-#include <mail/em-folder-utils.h>
-#include <mail/em-folder-view.h>
-#include <mail/mail-mt.h>
+//#include <mail/em-folder-tree-model.h>
+//#include <mail/em-folder-utils.h>
+//#include <mail/em-folder-view.h>
+//#include <mail/mail-mt.h>
 #include <mail/mail-component.h>
 #include <mail/mail-tools.h>
 #include <mail/mail-ops.h>
 
 #include <misc/e-activity-handler.h>
 
-#include <mail/em-format.h>
+//#include <mail/em-format.h>
 #include <mail/em-format-html.h>
-
 #include <mail/em-format-hook.h>
 
 #include <sys/types.h>
@@ -82,12 +81,8 @@ int rss_verbose_debug = 0;
 
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
 #include <bonobo/bonobo-shlib-factory.h>
 
-#include <glade/glade-xml.h>
-#include <glade/glade.h>
-//#include <shell/e-component-view.h>///
 #include <shell/es-event.h>
 #include <camel/camel-data-cache.h>
 #include <camel/camel-file-utils.h>
@@ -95,6 +90,7 @@ int rss_verbose_debug = 0;
 #include <libxml/parserInternals.h>
 #include <libxml/xmlmemory.h>
 #include <libxml/HTMLparser.h>
+#include <libxml/HTMLtree.h>
 
 #ifdef HAVE_RENDERKIT
 #ifdef HAVE_GECKO
@@ -124,8 +120,6 @@ int rss_verbose_debug = 0;
 
 #endif
 
-#include <errno.h>
-
 #include <libsoup/soup.h>
 #if LIBSOUP_VERSION < 2003000
 #include <libsoup/soup-message-queue.h>
@@ -137,7 +131,7 @@ int rss_verbose_debug = 0;
 
 #include "rss.h"
 #include "parser.h"
-#include "network-soup.c"
+#include "network-soup.h"
 #include "file-gio.c"
 #include "fetch.c"
 #include "misc.h"
@@ -186,6 +180,8 @@ gchar *pixfile;
 char *pixfilebuf;
 gsize pixfilelen;
 extern int xmlSubstituteEntitiesDefaultValue;
+extern EProxy *proxy;
+SoupSession *webkit_session = NULL;
 
 rssfeed *rf = NULL;
 guint           upgrade = 0;                // set to 2 when initailization successfull
@@ -753,7 +749,7 @@ proxy_auth_dialog(gchar *title, gchar *user, gchar *pass)
 gboolean
 timeout_soup(void)
 {
-	g_print("Network timeout occured. Cancel active operations.\n");
+	d(g_print("Network timeout occured. Cancel active operations.\n"));
 	abort_all_soup();
 	return FALSE;
 }
@@ -1591,7 +1587,7 @@ gecko_click(GtkMozEmbed *mozembed, gpointer dom_event, gpointer user_data)
 		menus = g_slist_prepend(menus, &rss_menu_items[i]);
 
         e_popup_add_items((EPopup *)emp, menus, NULL, rss_menu_items_free, link);
-        menu = e_popup_create_menu_once((EPopup *)emp, target, 0);
+        menu = e_popup_create_menu_once((EPopup *)emp, NULL, 0);
 
 	if (button == 2)
 		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, button, gtk_get_current_event_time());
@@ -2242,7 +2238,7 @@ setup_feed(add_feed *feed)
 	guint ret = 0;
 	guint ttl;
         RDF *r = NULL;
-        GString *post;
+        GString *post = NULL;
         GError *err = NULL;
         GString *content = NULL;
 	gchar *chn_name = NULL;
@@ -3292,8 +3288,8 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
 	g_print("mail_folder:%s\n", info->old_base);
 
 	gchar *idxname = g_strconcat(path, "/local/", info->new->full_name, ".ibex", NULL);
-	gchar *oldname = g_strconcat(path, "/local/", info->old_base, ".ibex", NULL);
-	g_print("idx:%s\n", idxname);
+	/*gchar *oldname = g_strconcat(path, "/local/", info->old_base, ".ibex", NULL);
+	g_print("idx:%s\n", idxname);*/
 	idx = (CamelIndex *)camel_text_index_new(idxname, O_TRUNC|O_CREAT|O_RDWR);
 //	camel_text_index_rename(oldname, idxname);
 	//camel_index_delete(idx);
diff --git a/src/rss.h b/src/rss.h
index 93e793e..de46e40 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -348,6 +348,8 @@ void gio_finish_feed (GObject *object, GAsyncResult *res, gpointer user_data);
 gchar *encode_rfc2047(gchar *str);
 CamelFolder *check_feed_folder(gchar *folder_name);
 gboolean setup_feed(add_feed *feed);
+gboolean feed_is_new(gchar *file_name, gchar *needle);
+gboolean web_auth_dialog(gchar *url);
 
 #ifdef _WIN32
 char *strcasestr(const char *a, const char *b);



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