[totem-pl-parser] Use GMime instead of libcamel for dates parsing



commit 687be91aefe701d0d28211a73644e3b609a166af
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 23 20:02:28 2009 +0100

    Use GMime instead of libcamel for dates parsing
    
    2009-07-23  Bastien Nocera  <hadess hadess net>
    
    	* README:
    	* configure.in:
    	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_add_rss),
    	(totem_pl_parser_add_itpc), (totem_pl_parser_add_zune),
    	(totem_pl_parser_add_atom), (totem_pl_parser_add_xml_feed),
    	(totem_pl_parser_add_itms), (totem_pl_parser_add_opml):
    	* plparse/totem-pl-parser-podcast.h:
    	* plparse/totem-pl-parser.c (totem_pl_parser_parse_date):
    	* totem-plparser-uninstalled.pc.in:
    	* totem-plparser.pc.in: Use GMime instead of libcamel
    	for dates parsing. Hopefully good enough for people to
    	stop shipping crippled versions of totem-pl-parser

 ChangeLog                         |   15 ++++++++++
 README                            |    1 +
 configure.in                      |   52 ++++++++++++++++++------------------
 plparse/totem-pl-parser-podcast.c |   42 +++++++++++++++---------------
 plparse/totem-pl-parser-podcast.h |    8 +++---
 plparse/totem-pl-parser.c         |   12 ++++----
 totem-plparser-uninstalled.pc.in  |    2 +-
 totem-plparser.pc.in              |    2 +-
 8 files changed, 75 insertions(+), 59 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3c43780..6318e37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2009-07-23  Bastien Nocera  <hadess hadess net>
 
+	* README:
+	* configure.in:
+	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_add_rss),
+	(totem_pl_parser_add_itpc), (totem_pl_parser_add_zune),
+	(totem_pl_parser_add_atom), (totem_pl_parser_add_xml_feed),
+	(totem_pl_parser_add_itms), (totem_pl_parser_add_opml):
+	* plparse/totem-pl-parser-podcast.h:
+	* plparse/totem-pl-parser.c (totem_pl_parser_parse_date):
+	* totem-plparser-uninstalled.pc.in:
+	* totem-plparser.pc.in: Use GMime instead of libcamel
+	for dates parsing. Hopefully good enough for people to
+	stop shipping crippled versions of totem-pl-parser
+
+2009-07-23  Bastien Nocera  <hadess hadess net>
+
 	* plparse/tests/parser.c (test_data_get_data), (test_parsability):
 	Add more debug when a parse error happens
 
diff --git a/README b/README
index 77fbbdf..c527786 100644
--- a/README
+++ b/README
@@ -16,6 +16,7 @@ Dependencies
 ============
 
 glib with GIO (glib 2.16)
+gmime 2.4
 
 BUGS
 ====
diff --git a/configure.in b/configure.in
index e735978..e43b6ae 100644
--- a/configure.in
+++ b/configure.in
@@ -46,7 +46,7 @@ DBUS_REQS=0.61
 # - If binary compatibility has been broken (eg removed or changed interfaces)
 #   change to C+1:0:0
 # - If the interface is the same as the previous version, change to C:R+1:A
-PLPARSER_LT_VERSION=15:4:3
+PLPARSER_LT_VERSION=16:4:4
 AC_SUBST(PLPARSER_LT_VERSION)
 
 TOTEM_PL_PARSER_VERSION_MAJOR=totem_version_major
@@ -59,35 +59,35 @@ AC_SUBST(TOTEM_PL_PARSER_VERSION_MICRO)
 pkg_modules="glib-2.0 >= $GLIB_REQS gtk+-2.0 libxml-2.0 gthread-2.0 gio-2.0 >= $GIO_REQS"
 
 ##################################
-# Checking libcamel dependency
+# Checking libgmime dependency
 ##################################
-camel_message=""
-
-AC_ARG_ENABLE(camel-i-know-what-im-doing,
-	      AS_HELP_STRING([--disable-camel-i-know-what-im-doing],
-			     [Disable libcamel (Unsupported, breaks Podcast support).]),
-			     [enable_camel=no],
-			     [enable_camel=yes])
-
-if test "x$enable_camel" = "xyes" ; then
-   PKG_CHECK_MODULES(LIBCAMEL,  
-		     camel-1.2,
-                     [have_camel=yes], 
-                     [have_camel=no])
-
-   if test "x$have_camel" = "xyes" ; then
-      AC_SUBST(LIBCAMEL, camel-1.2)
-      AC_SUBST(USELIBCAMEL, yes)
-      AC_DEFINE(HAVE_CAMEL, 1, [Camel available in the system])
-      pkg_modules="$pkg_modules camel-1.2"
+gmime_message=""
+
+AC_ARG_ENABLE(gmime-i-know-what-im-doing,
+	      AS_HELP_STRING([--disable-gmime-i-know-what-im-doing],
+			     [Disable libgmime (Unsupported, breaks Podcast support).]),
+			     [enable_gmime=no],
+			     [enable_gmime=yes])
+
+if test "x$enable_gmime" = "xyes" ; then
+   PKG_CHECK_MODULES(GMIME,  
+		     gmime-2.4,
+                     [have_gmime=yes], 
+                     [have_gmime=no])
+
+   if test "x$have_gmime" = "xyes" ; then
+      AC_SUBST(GMIME, gmime-1.2)
+      AC_SUBST(USEGMIME, yes)
+      AC_DEFINE(HAVE_GMIME, 1, [GMime available in the system])
+      pkg_modules="$pkg_modules gmime-2.4"
    else
-      AC_MSG_ERROR([libcamel is required to compile totem-pl-parser.])
+      AC_MSG_ERROR([libgmime is required to compile totem-pl-parser.])
    fi
 else
-   AC_SUBST(USELIBCAMEL, no)
-   camel_message="
+   AC_SUBST(USEGMIME, no)
+   gmime_message="
  **************************************************************
- Compiling totem-pl-parser without libcamel.
+ Compiling totem-pl-parser without libgmime.
  This will break podcast support and is completely unsupported.
  **************************************************************"
 fi
@@ -143,5 +143,5 @@ docs/reference/version.xml
 AC_OUTPUT
 
 echo "
-$camel_message
+$gmime_message
 "
diff --git a/plparse/totem-pl-parser-podcast.c b/plparse/totem-pl-parser-podcast.c
index e77252b..baf6c2b 100644
--- a/plparse/totem-pl-parser-podcast.c
+++ b/plparse/totem-pl-parser-podcast.c
@@ -236,8 +236,8 @@ totem_pl_parser_add_rss (TotemPlParser *parser,
 			 TotemPlParseData *parse_data,
 			 gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	xml_node_t* doc, *channel;
 	char *contents;
@@ -278,7 +278,7 @@ totem_pl_parser_add_rss (TotemPlParser *parser,
 	xml_parser_free_tree (doc);
 
 	return TOTEM_PL_PARSER_RESULT_SUCCESS;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 /* http://www.apple.com/itunes/store/podcaststechspecs.html */
@@ -289,8 +289,8 @@ totem_pl_parser_add_itpc (TotemPlParser *parser,
 			  TotemPlParseData *parse_data,
 			  gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	TotemPlParserResult ret;
 	char *uri, *new_uri, *uri_scheme;
@@ -310,7 +310,7 @@ totem_pl_parser_add_itpc (TotemPlParser *parser,
 	g_object_unref (new_file);
 
 	return ret;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 TotemPlParserResult
@@ -320,8 +320,8 @@ totem_pl_parser_add_zune (TotemPlParser *parser,
 			  TotemPlParseData *parse_data,
 			  gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	TotemPlParserResult ret;
 	char *uri, *new_uri;
@@ -349,7 +349,7 @@ totem_pl_parser_add_zune (TotemPlParser *parser,
 	g_object_unref (new_file);
 
 	return ret;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 /* Atom docs:
@@ -489,8 +489,8 @@ totem_pl_parser_add_atom (TotemPlParser *parser,
 			  TotemPlParseData *parse_data,
 			  gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	xml_node_t* doc;
 	char *contents, *uri;
@@ -521,7 +521,7 @@ totem_pl_parser_add_atom (TotemPlParser *parser,
 	xml_parser_free_tree (doc);
 
 	return TOTEM_PL_PARSER_RESULT_SUCCESS;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 TotemPlParserResult
@@ -531,8 +531,8 @@ totem_pl_parser_add_xml_feed (TotemPlParser *parser,
 			      TotemPlParseData *parse_data,
 			      gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	guint len;
 
@@ -549,7 +549,7 @@ totem_pl_parser_add_xml_feed (TotemPlParser *parser,
 		return totem_pl_parser_add_opml (parser, file, base_file, parse_data, data);
 
 	return TOTEM_PL_PARSER_RESULT_UNHANDLED;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 /* From libgsf's gsf-utils.h */
@@ -722,8 +722,8 @@ totem_pl_parser_add_itms (TotemPlParser *parser,
 			  TotemPlParseData *parse_data,
 			  gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	char *contents, *uncompressed, *itms_uri;
 	GFile *itms_file, *feed_file;
@@ -783,7 +783,7 @@ totem_pl_parser_add_itms (TotemPlParser *parser,
 	g_object_unref (feed_file);
 
 	return ret;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 gboolean
@@ -883,8 +883,8 @@ totem_pl_parser_add_opml (TotemPlParser *parser,
 			  TotemPlParseData *parse_data,
 			  gpointer data)
 {
-#ifndef HAVE_CAMEL
-	WARN_NO_CAMEL;
+#ifndef HAVE_GMIME
+	WARN_NO_GMIME;
 #else
 	xml_node_t* doc;
 	char *contents, *uri;
@@ -915,7 +915,7 @@ totem_pl_parser_add_opml (TotemPlParser *parser,
 	xml_parser_free_tree (doc);
 
 	return TOTEM_PL_PARSER_RESULT_SUCCESS;
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 }
 
 #endif /* !TOTEM_PL_PARSER_MINI */
diff --git a/plparse/totem-pl-parser-podcast.h b/plparse/totem-pl-parser-podcast.h
index ba3e592..c8fb934 100644
--- a/plparse/totem-pl-parser-podcast.h
+++ b/plparse/totem-pl-parser-podcast.h
@@ -39,12 +39,12 @@ const char * totem_pl_parser_is_xml_feed (const char *data, gsize len);
 
 #ifndef TOTEM_PL_PARSER_MINI
 
-#ifndef HAVE_CAMEL
-#define WARN_NO_CAMEL { \
-	g_warning("Trying to parse a podcast, but totem-pl-parser built without libcamel support. Please contact your distribution provider."); \
+#ifndef HAVE_GMIME
+#define WARN_NO_GMIME { \
+	g_warning("Trying to parse a podcast, but totem-pl-parser built without libgmime support. Please contact your distribution provider."); \
 	return TOTEM_PL_PARSER_RESULT_ERROR; \
 }
-#endif /* !HAVE_CAMEL */
+#endif /* !HAVE_GMIME */
 
 gboolean totem_pl_parser_is_itms_feed (GFile *file);
 
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index e768ad8..a4be352 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -134,8 +134,8 @@
 #include <gobject/gvaluecollector.h>
 #include <gtk/gtk.h>
 
-#ifdef HAVE_CAMEL
-#include <camel/camel-mime-utils.h>
+#ifdef HAVE_GMIME
+#include <gmime/gmime-utils.h>
 #endif
 
 #include "totem-pl-parser.h"
@@ -2252,7 +2252,7 @@ totem_pl_parser_parse_duration (const char *duration, gboolean debug)
 guint64
 totem_pl_parser_parse_date (const char *date_str, gboolean debug)
 {
-#ifdef HAVE_CAMEL
+#ifdef HAVE_GMIME
 	GTimeVal val;
 
 	g_return_val_if_fail (date_str != NULL, -1);
@@ -2265,10 +2265,10 @@ totem_pl_parser_parse_date (const char *date_str, gboolean debug)
 	}
 	D(g_message ("Failed to parse duration '%s' using the ISO8601 parser", date_str));
 	/* Fall back to RFC 2822 date parsing */
-	return camel_header_decode_date (date_str, NULL);
+	return g_mime_utils_header_decode_date (date_str, NULL);
 #else
-	WARN_NO_CAMEL;
-#endif /* HAVE_CAMEL */
+	WARN_NO_GMIME;
+#endif /* HAVE_GMIME */
 }
 #endif /* !TOTEM_PL_PARSER_MINI */
 
diff --git a/totem-plparser-uninstalled.pc.in b/totem-plparser-uninstalled.pc.in
index 3a732f2..47f0748 100644
--- a/totem-plparser-uninstalled.pc.in
+++ b/totem-plparser-uninstalled.pc.in
@@ -9,6 +9,6 @@ Name: totem-plparser
 Description: Totem Playlist Parser library
 Version: @VERSION@
 Requires: gtk+-2.0
-Requires.private: libxml-2.0 camel-1.2
+Requires.private: libxml-2.0 gmime-2.4
 Libs: ${pc_top_builddir}/${pcfiledir}/plparse/libtotem-plparser.la
 Cflags: -I${pc_top_builddir}/${pcfiledir}/plparse
diff --git a/totem-plparser.pc.in b/totem-plparser.pc.in
index 7b186ad..363df1a 100644
--- a/totem-plparser.pc.in
+++ b/totem-plparser.pc.in
@@ -9,7 +9,7 @@ Name: totem-plparser
 Description: Totem Playlist Parser library
 Version: @VERSION@
 Requires: gtk+-2.0
-Requires.private: libxml-2.0 @LIBCAMEL@
+Requires.private: libxml-2.0 @GMIME@
 Libs: -L${libdir} -ltotem-plparser
 Cflags: -I${includedir}/totem-pl-parser/1/plparser
 uselibcamel= USELIBCAMEL@



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