[Commits] [SCM] claws branch, master, updated. 3.11.1-96-g455d234

ticho at claws-mail.org ticho at claws-mail.org
Thu May 7 00:34:03 CEST 2015


The branch, master has been updated
       via  455d234394df62e372790f4ebeb4a395204fe051 (commit)
      from  3d05195eb6ee5053e8b0ef19f6e3bf80d84e1e50 (commit)

Summary of changes:
 src/plugins/rssyl/libfeed/date.c         |   29 -----------------------------
 src/plugins/rssyl/libfeed/date.h         |    1 -
 src/plugins/rssyl/libfeed/parser_rdf.c   |    6 ++++--
 src/plugins/rssyl/libfeed/parser_rss20.c |    6 ++++--
 4 files changed, 8 insertions(+), 34 deletions(-)


- Log -----------------------------------------------------------------
commit 455d234394df62e372790f4ebeb4a395204fe051
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu May 7 00:19:03 2015 +0200

    RSSyl: use procheader_date_parse() instead of parseRFC822Date().

diff --git a/src/plugins/rssyl/libfeed/date.c b/src/plugins/rssyl/libfeed/date.c
index 92f5a86..b00555a 100644
--- a/src/plugins/rssyl/libfeed/date.c
+++ b/src/plugins/rssyl/libfeed/date.c
@@ -120,32 +120,3 @@ gchar *createRFC822Date(const time_t *time) {
 	return g_strdup_printf("%s, %2d %s %4d %02d:%02d:%02d GMT", dayofweek[tm->tm_wday], tm->tm_mday,
 					   months[tm->tm_mon], 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec);
 }
-
-time_t parseRFC822Date(gchar *date)
-{
-	struct tm t;
-	memset(&t, 0, sizeof(struct tm));
-	const char *c = setlocale(LC_TIME, NULL);
-
-	/* Adjust the LC_TIME locale to standard C in order for strptime()
-	 * to work reliably. */
-	if (c != NULL)
-		setlocale(LC_TIME, "C");
-
-	if (date != NULL &&
-			!strptime(date, "%a, %d %b %Y %H:%M:%S %Z", &t) &&
-			!strptime(date, "%a, %d %b %Y %H:%M %Z", &t) &&
-			!strptime(date, "%d %b %Y %H:%M:%S %Z", &t) &&
-			!strptime(date, "%d %b %Y %H:%M %Z", &t)) {
-		g_warning("Invalid RFC822 date!\n");
-		if (c != NULL)
-			setlocale(LC_TIME, c);
-		return 0;
-	}
-
-	/* Restore the original LC_TIME locale. */
-	if (c != NULL)
-		setlocale(LC_TIME, c);
-
-	return mktime(&t);
-}
diff --git a/src/plugins/rssyl/libfeed/date.h b/src/plugins/rssyl/libfeed/date.h
index c8ea1a6..27c1353 100644
--- a/src/plugins/rssyl/libfeed/date.h
+++ b/src/plugins/rssyl/libfeed/date.h
@@ -6,6 +6,5 @@
 
 time_t parseISO8601Date(gchar *date);
 gchar *createRFC822Date(const time_t *time);
-time_t parseRFC822Date(gchar *date);
 
 #endif /* __DATE_H */
diff --git a/src/plugins/rssyl/libfeed/parser_rdf.c b/src/plugins/rssyl/libfeed/parser_rdf.c
index f469e06..02b80ea 100644
--- a/src/plugins/rssyl/libfeed/parser_rdf.c
+++ b/src/plugins/rssyl/libfeed/parser_rdf.c
@@ -22,6 +22,8 @@
 #include <expat.h>
 #include <string.h>
 
+#include <procheader.h>
+
 #include "feed.h"
 #include "date.h"
 #include "parser_rdf.h"
@@ -104,7 +106,7 @@ void feed_parser_rdf_end(void *data, const gchar *el)
 					} else if( !strcmp(el, "dc:date") ) {
 						feed->date = parseISO8601Date(text);
 					} else if( !strcmp(el, "pubDate") ) {
-						feed->date = parseRFC822Date(text);
+						feed->date = procheader_date_parse(NULL, text, 0);
 					}
 
 					break;
@@ -129,7 +131,7 @@ void feed_parser_rdf_end(void *data, const gchar *el)
 					} else if( !strcmp(el, "dc:date") ) {
 						ctx->curitem->date_modified = parseISO8601Date(text);
 					} else if( !strcmp(el, "pubDate") ) {
-						ctx->curitem->date_modified = parseRFC822Date(text);
+						ctx->curitem->date_modified = procheader_date_parse(NULL, text, 0);
 					}
 
 					break;
diff --git a/src/plugins/rssyl/libfeed/parser_rss20.c b/src/plugins/rssyl/libfeed/parser_rss20.c
index 3882750..25cea33 100644
--- a/src/plugins/rssyl/libfeed/parser_rss20.c
+++ b/src/plugins/rssyl/libfeed/parser_rss20.c
@@ -22,6 +22,8 @@
 #include <expat.h>
 #include <string.h>
 
+#include <procheader.h>
+
 #include "feed.h"
 #include "feeditem.h"
 #include "feeditemenclosure.h"
@@ -132,7 +134,7 @@ void feed_parser_rss20_end(void *data, const gchar *el)
 			} else if( !strcmp(el, "dc:date") ) {
 				feed->date = parseISO8601Date(text);
 			} else if( !strcmp(el, "pubDate") ) {
-				feed->date = parseRFC822Date(text);
+				feed->date = procheader_date_parse(NULL, text, 0);
 			}
 
 			break;
@@ -162,7 +164,7 @@ void feed_parser_rss20_end(void *data, const gchar *el)
 			} else if( !strcmp(el, "dc:date") ) {
 				ctx->curitem->date_modified = parseISO8601Date(text);
 			} else if( !strcmp(el, "pubDate") ) {
-				ctx->curitem->date_modified = parseRFC822Date(text);
+				ctx->curitem->date_modified = procheader_date_parse(NULL, text, 0);
 			} else if( !strcmp(el, "dc:creator")) {
 				FILL(ctx->curitem->author)
 			}

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list