[Commits] folder.c 1.213.2.213 1.213.2.214 folder.h 1.87.2.68 1.87.2.69 imap.c 1.179.2.263 1.179.2.264 procmsg.c 1.150.2.129 1.150.2.130 procmsg.h 1.60.2.64 1.60.2.65 summaryview.c 1.395.2.454 1.395.2.455

colin at claws-mail.org colin at claws-mail.org
Wed Sep 26 09:39:34 CEST 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv18169/src

Modified Files:
      Tag: gtk2
	folder.c folder.h imap.c procmsg.c procmsg.h summaryview.c 
Log Message:
2012-09-26 [colin]	3.8.1cvs74

	* src/folder.c
	* src/folder.h
	* src/imap.c
	* src/procmsg.c
	* src/procmsg.h
	* src/summaryview.c
		Factorize msg list to num list code;
		Make search faster using cache instead
		of network I/O

Index: procmsg.h
===================================================================
RCS file: /home/claws-mail/claws/src/procmsg.h,v
retrieving revision 1.60.2.64
retrieving revision 1.60.2.65
diff -u -d -r1.60.2.64 -r1.60.2.65
--- procmsg.h	8 Sep 2012 20:23:11 -0000	1.60.2.64
+++ procmsg.h	26 Sep 2012 07:39:32 -0000	1.60.2.65
@@ -281,7 +281,8 @@
 
 GSList *procmsg_read_cache		(FolderItem	*item,
 					 gboolean	 scan_file);
-void	procmsg_msg_list_free		(GSList		*mlist);
+void	procmsg_msg_list_free		(MsgInfoList	*mlist);
+MsgNumberList *procmsg_get_number_list_for_msgs(MsgInfoList *msglist);
 void	procmsg_get_mark_sum		(const gchar	*folder,
 					 gint		*new_msgs,
 					 gint		*unread_msgs,

Index: folder.c
===================================================================
RCS file: /home/claws-mail/claws/src/folder.c,v
retrieving revision 1.213.2.213
retrieving revision 1.213.2.214
diff -u -d -r1.213.2.213 -r1.213.2.214
--- folder.c	21 Sep 2012 19:44:03 -0000	1.213.2.213
+++ folder.c	26 Sep 2012 07:39:31 -0000	1.213.2.214
@@ -4749,6 +4749,17 @@
 	}
 }
 
+MsgNumberList *folder_item_get_number_list(FolderItem *item)
+{
+	GSList *nums = NULL;
+	GSList *msglist = folder_item_get_msg_list(item);
+
+	nums = procmsg_get_number_list_for_msgs(msglist);
+	procmsg_msg_list_free(msglist);
+	
+	return nums;
+}
+
 gint folder_item_search_msgs_local	(Folder			*folder,
 					 FolderItem		*container,
 					 MsgNumberList		**msgs,
@@ -4765,17 +4776,16 @@
 	GSList *nums = NULL;
 
 	if (*msgs == NULL) {
-		gboolean old_valid = TRUE;
-	       
-		msgcount = folder->klass->get_num_list(folder, container, &nums, &old_valid);
-		
-		if (msgcount < 0)
-			return -1;
+		nums = folder_item_get_number_list(container);
 	} else {
 		nums = *msgs;
-		msgcount = g_slist_length(nums);
 	}
 
+	msgcount = g_slist_length(nums);
+
+	if (msgcount < 0)
+		return -1;
+
 	for (cur = nums; cur != NULL; cur = cur->next) {
 		guint msgnum = GPOINTER_TO_UINT(cur->data);
 		MsgInfo *msg = folder_item_get_msginfo(container, msgnum);

Index: imap.c
===================================================================
RCS file: /home/claws-mail/claws/src/imap.c,v
retrieving revision 1.179.2.263
retrieving revision 1.179.2.264
diff -u -d -r1.179.2.263 -r1.179.2.264
--- imap.c	21 Sep 2012 10:19:42 -0000	1.179.2.263
+++ imap.c	26 Sep 2012 07:39:31 -0000	1.179.2.264
@@ -5226,15 +5226,10 @@
 static GSList * imap_get_lep_set_from_msglist(IMAPFolder *folder, MsgInfoList *msglist)
 {
 	MsgNumberList *numlist = NULL;
-	MsgInfoList *cur;
 	GSList *seq_list;
 
-	for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
-		MsgInfo *msginfo = (MsgInfo *) cur->data;
+	numlist = procmsg_get_number_list_for_msgs(msglist);
 
-		numlist = g_slist_prepend(numlist, GINT_TO_POINTER(msginfo->msgnum));
-	}
-	numlist = g_slist_reverse(numlist);
 	seq_list = imap_get_lep_set_from_numlist(folder, numlist);
 	g_slist_free(numlist);
 

Index: summaryview.c
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.c,v
retrieving revision 1.395.2.454
retrieving revision 1.395.2.455
diff -u -d -r1.395.2.454 -r1.395.2.455
--- summaryview.c	21 Sep 2012 10:19:43 -0000	1.395.2.454
+++ summaryview.c	26 Sep 2012 07:39:32 -0000	1.395.2.455
@@ -2157,12 +2157,8 @@
 
 	ctree = GTK_CMCTREE(summaryview->ctree);
 
-	msgnum_list = NULL;
-	for(walk = msginfos; walk; walk = walk->next) {
-		MsgInfo *msginfo;
-		msginfo = walk->data;
-		msgnum_list = g_slist_prepend(msgnum_list, GUINT_TO_POINTER(msginfo->msgnum));
-	}
+	msgnum_list = procmsg_get_number_list_for_msgs(msginfos);
+
 	START_LONG_OPERATION(summaryview, FALSE);
 	for(walk = msgnum_list; walk; walk = walk->next) {
 		GtkCMCTreeNode *node;

Index: folder.h
===================================================================
RCS file: /home/claws-mail/claws/src/folder.h,v
retrieving revision 1.87.2.68
retrieving revision 1.87.2.69
diff -u -d -r1.87.2.68 -r1.87.2.69
--- folder.h	21 Sep 2012 10:19:42 -0000	1.87.2.68
+++ folder.h	26 Sep 2012 07:39:31 -0000	1.87.2.69
@@ -912,6 +912,8 @@
 MsgInfo *folder_item_get_msginfo_by_msgid(FolderItem 	*item,
 					 const gchar 	*msgid);
 GSList *folder_item_get_msg_list	(FolderItem 	*item);
+MsgNumberList *folder_item_get_number_list(FolderItem *item);
+
 /* return value is locale charset */
 gchar *folder_item_fetch_msg		(FolderItem	*item,
 					 gint		 num);

Index: procmsg.c
===================================================================
RCS file: /home/claws-mail/claws/src/procmsg.c,v
retrieving revision 1.150.2.129
retrieving revision 1.150.2.130
diff -u -d -r1.150.2.129 -r1.150.2.130
--- procmsg.c	16 Sep 2012 21:56:21 -0000	1.150.2.129
+++ procmsg.c	26 Sep 2012 07:39:32 -0000	1.150.2.130
@@ -89,6 +89,19 @@
 	g_slist_free(mlist);
 }
 
+MsgNumberList *procmsg_get_number_list_for_msgs(MsgInfoList *msglist)
+{
+	GSList *cur = NULL;
+	GSList *nums = NULL;
+
+	for (cur = msglist; cur; cur = cur->next) {
+		MsgInfo *msg = (MsgInfo *)cur->data;
+		nums = g_slist_prepend(nums, GUINT_TO_POINTER(msg->msgnum));
+	}
+
+	return g_slist_reverse(nums);
+}
+
 struct MarkSum {
 	gint *new_msgs;
 	gint *unread_msgs;



More information about the Commits mailing list