[Commits] [SCM] claws branch, master, updated. 3.11.0-9-g8987e56

ticho at claws-mail.org ticho at claws-mail.org
Thu Oct 23 18:34:10 CEST 2014


The branch, master has been updated
       via  8987e5620e0689676355715d8a6e990aec5277fc (commit)
      from  f9816ddf416fb29d199d57a53a87c932e5dc9895 (commit)

Summary of changes:
 src/plugins/rssyl/rssyl.c |   27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 8987e5620e0689676355715d8a6e990aec5277fc
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Oct 23 18:33:42 2014 +0200

    RSSyl: start using folder cache

diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
index da71b58..5753a00 100644
--- a/src/plugins/rssyl/rssyl.c
+++ b/src/plugins/rssyl/rssyl.c
@@ -647,9 +647,27 @@ static gint rssyl_get_num_list(Folder *folder, FolderItem *item,
 	return nummsgs;
 }
 
-static gboolean rssyl_scan_required(Folder *folder, FolderItem *item)
+static gboolean rssyl_is_msg_changed(Folder *folder, FolderItem *item,
+		MsgInfo *msginfo)
 {
-	return TRUE;
+	struct stat s;
+	gchar *path = NULL;
+
+	g_return_val_if_fail(folder != NULL, FALSE);
+	g_return_val_if_fail(item != NULL, FALSE);
+	g_return_val_if_fail(msginfo != NULL, FALSE);
+
+	path = g_strconcat(folder_item_get_path(item), G_DIR_SEPARATOR_S,
+			itos(msginfo->msgnum), NULL);
+
+	if (g_stat(path, &s) < 0 ||
+		msginfo->size != s.st_size || (
+				(msginfo->mtime - s.st_mtime != 0) &&
+				(msginfo->mtime - s.st_mtime != 3600) &&
+				(msginfo->mtime - s.st_mtime != -3600)))
+		return TRUE;
+
+	return FALSE;
 }
 
 static gchar *rssyl_fetch_msg(Folder *folder, FolderItem *item, gint num)
@@ -770,7 +788,7 @@ static gint rssyl_remove_msg(Folder *folder, FolderItem *item, gint num)
 	file = rssyl_fetch_msg(folder, item, num);
 	g_return_val_if_fail(file != NULL, -1);
 
-	need_scan = rssyl_scan_required(folder, item);
+	need_scan = mh_get_class()->scan_required(folder, item);
 
 	/* are we doing a folder move ? */
 	tmp = g_strdup_printf("%s.tmp", file);
@@ -883,7 +901,7 @@ FolderClass *rssyl_folder_get_class()
 		rssyl_class.rename_folder = rssyl_rename_folder;
 		rssyl_class.remove_folder = rssyl_remove_folder;
 		rssyl_class.get_num_list = rssyl_get_num_list;
-		rssyl_class.scan_required = rssyl_scan_required;
+		rssyl_class.scan_required = mh_get_class()->scan_required;
 		rssyl_class.item_set_xml = rssyl_item_set_xml;
 		rssyl_class.item_get_xml = rssyl_item_get_xml;
 
@@ -896,6 +914,7 @@ FolderClass *rssyl_folder_get_class()
 		rssyl_class.add_msgs = rssyl_add_msgs;
 		rssyl_class.remove_msg = rssyl_remove_msg;
 		rssyl_class.remove_msgs = NULL;
+		rssyl_class.is_msg_changed = rssyl_is_msg_changed;
 //		rssyl_class.change_flags = rssyl_change_flags;
 		rssyl_class.change_flags = NULL;
 		rssyl_class.subscribe = rssyl_subscribe_uri;

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list