summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-04-13 10:52:19 +0100
committerBastien Nocera <hadess@hadess.net>2017-04-13 12:27:35 +0200
commit08f6a2f6d761fd835c492eac82d1b6bd387e3ecd (patch)
tree9801fa1cbc122e5c2c0686da6fb52ce17a6594fd
parent972138e113efa9971cba2bb9c13d5656af68226c (diff)
downloadtotem-pl-parser-08f6a2f6d761fd835c492eac82d1b6bd387e3ecd.tar.gz
build: Fix build with GMime 3.0
The g_mime_utils_header_decode_date() function changed in GMime 3.0: it now takes a single argument, and generates a GDateTime instead of a Unix timestamp. https://bugzilla.gnome.org/show_bug.cgi?id=781254
-rw-r--r--plparse/totem-pl-parser.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index 3cb579d..bd46c03 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -2355,7 +2355,19 @@ 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 */
+#ifdef HAVE_GMIME3
+ {
+ g_autoptr(GDateTime) date = NULL;
+ date = g_mime_utils_header_decode_date (date_str);
+ if (!date || !g_date_time_to_timeval (date, &val)) {
+ D(g_message ("Failed to parse duration '%s' using the RFC 2822 parser", date_str));
+ return -1;
+ }
+ return val.tv_sec;
+ }
+#else
return g_mime_utils_header_decode_date (date_str, NULL);
+#endif /* HAVE_GMIME3 */
#else
WARN_NO_GMIME;
#endif /* HAVE_GMIME */