[Commits] [SCM] claws branch, master, updated. 3.17.0-55-g65301ac

ticho at claws-mail.org ticho at claws-mail.org
Tue Sep 18 19:30:04 CEST 2018


The branch, master has been updated
       via  65301ac547ffe70fd2726f4e1320103b307b9b19 (commit)
       via  eff481a299357c39b1f151e2b3d012ecb47cfb0b (commit)
      from  102ceb8bd99993bee542af5e7509c8401017a5db (commit)

Summary of changes:
 src/plugins/rssyl/libfeed/parser_rss20.c |    3 ++-
 src/plugins/rssyl/parse822.c             |    4 +++-
 src/plugins/rssyl/rssyl_add_item.c       |   23 +++++++++++++++++++++--
 3 files changed, 26 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 65301ac547ffe70fd2726f4e1320103b307b9b19
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Tue Sep 18 19:29:12 2018 +0200

    Set missing pubdate/moddate in RSSyl items to the other one, if available.

diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c
index b153936..3f12414 100644
--- a/src/plugins/rssyl/parse822.c
+++ b/src/plugins/rssyl/parse822.c
@@ -103,10 +103,12 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
 					started_author = TRUE;
 				}
 
-				/* Date */
+				/* Date (set both FeedItem timestamps) */
 				if( !strcmp(line[0], "Date") ) {
 					feed_item_set_date_modified(item,
 							procheader_date_parse(NULL, line[1], 0));
+					feed_item_set_date_published(item,
+							feed_item_get_date_modified(item));
 					debug_print("RSSyl: got date \n" );
 				}
 
diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c
index 25ce836..685d75b 100644
--- a/src/plugins/rssyl/rssyl_add_item.c
+++ b/src/plugins/rssyl/rssyl_add_item.c
@@ -303,11 +303,30 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 	}
 */
 
-	/* If neither item date is set, use date from source (Atom only). */
+	/* If one of the timestamps is empty, set it to value of the other one. */
 	if( feed_item_get_date_modified(feed_item) == -1 &&
-			feed_item_get_date_published(feed_item) == -1 )
+			feed_item_get_date_published(feed_item) >= 0 ) {
+		debug_print("RSSyl: setting missing moddate to pubdate %ld\n",
+				feed_item_get_date_published(feed_item));
+		feed_item_set_date_modified(feed_item,
+				feed_item_get_date_published(feed_item));
+	} else if( feed_item_get_date_published(feed_item) == -1 &&
+			feed_item_get_date_modified(feed_item) >= 0 ) {
+		debug_print("RSSyl: setting missing pubdate to modddate %ld\n",
+				feed_item_get_date_modified(feed_item));
 		feed_item_set_date_published(feed_item,
+				feed_item_get_date_modified(feed_item));
+	} else if( feed_item_get_date_modified(feed_item) == -1 &&
+			feed_item_get_date_published(feed_item) == -1 &&
+			feed_item_get_sourcedate(feed_item) >= 0 ) {
+		/* If neither item date is set, use date from source (Atom only). */
+		debug_print("RSSyl: setting missing pubdate and moddate to feed source date %ld\n",
 				feed_item_get_sourcedate(feed_item));
+		feed_item_set_date_modified(feed_item,
+				feed_item_get_sourcedate(feed_item));
+		feed_item_set_date_published(feed_item,
+				feed_item_get_sourcedate(feed_item));
+	}
 
 	/* Fix up subject, url and ID (rssyl_format_string()) so that
 	 * comparing doesn't break. */

commit eff481a299357c39b1f151e2b3d012ecb47cfb0b
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Tue Sep 18 19:28:28 2018 +0200

    The pubDate timestamp in RSS2.0 sets date_published.

diff --git a/src/plugins/rssyl/libfeed/parser_rss20.c b/src/plugins/rssyl/libfeed/parser_rss20.c
index df9c08e..c407894 100644
--- a/src/plugins/rssyl/libfeed/parser_rss20.c
+++ b/src/plugins/rssyl/libfeed/parser_rss20.c
@@ -29,6 +29,7 @@
 #include "feeditemenclosure.h"
 #include "date.h"
 #include "parser.h"
+#include "common/utils.h"
 
 void feed_parser_rss20_start(void *data, const gchar *el, const gchar **attr)
 {
@@ -164,7 +165,7 @@ void feed_parser_rss20_end(void *data, const gchar *el)
 			} else if( !strcmp(el, "dc:date") ) {
 				ctx->curitem->date_modified = procheader_date_parse(NULL, text, 0);
 			} else if( !strcmp(el, "pubDate") ) {
-				ctx->curitem->date_modified = procheader_date_parse(NULL, text, 0);
+				ctx->curitem->date_published = 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