2012-09-26 [colin] 3.8.1cvs74
authorColin Leroy <colin@colino.net>
Wed, 26 Sep 2012 07:39:32 +0000 (07:39 +0000)
committerColin Leroy <colin@colino.net>
Wed, 26 Sep 2012 07:39:32 +0000 (07:39 +0000)
* 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

ChangeLog
PATCHSETS
configure.ac
src/folder.c
src/folder.h
src/imap.c
src/procmsg.c
src/procmsg.h
src/summaryview.c

index a1fe26d..c8838ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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
+
 2012-09-25 [mones]     3.8.1cvs73
 
        * src/gtk/quicksearch.c
index 8f6dd89..10b408e 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/advsearch.c;  ) > 3.8.1cvs71.patchset
 ( cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/advsearch.c;  ) > 3.8.1cvs72.patchset
 ( cvs diff -u -r 1.1.2.113 -r 1.1.2.114 src/gtk/quicksearch.c;  ) > 3.8.1cvs73.patchset
+( cvs diff -u -r 1.213.2.213 -r 1.213.2.214 src/folder.c;  cvs diff -u -r 1.87.2.68 -r 1.87.2.69 src/folder.h;  cvs diff -u -r 1.179.2.263 -r 1.179.2.264 src/imap.c;  cvs diff -u -r 1.150.2.129 -r 1.150.2.130 src/procmsg.c;  cvs diff -u -r 1.60.2.64 -r 1.60.2.65 src/procmsg.h;  cvs diff -u -r 1.395.2.454 -r 1.395.2.455 src/summaryview.c;  ) > 3.8.1cvs74.patchset
index 405aabc..199eb98 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=8
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=73
+EXTRA_VERSION=74
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 9991b26..b8389b6 100644 (file)
@@ -4749,6 +4749,17 @@ gint folder_item_search_msgs     (Folder                 *folder,
        }
 }
 
+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 @@ gint folder_item_search_msgs_local      (Folder                 *folder,
        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 e8b5c52..d87eb0c 100644 (file)
@@ -912,6 +912,8 @@ MsgInfo *folder_item_get_msginfo    (FolderItem     *item,
 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 ddeceba..eb0408c 100644 (file)
@@ -5226,15 +5226,10 @@ static GSList * imap_get_lep_set_from_numlist(IMAPFolder *folder, MsgNumberList
 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 cb58ce3..08888d0 100644 (file)
@@ -89,6 +89,19 @@ void procmsg_msg_list_free(GSList *mlist)
        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;
index 9202b14..e13f8e5 100644 (file)
@@ -281,7 +281,8 @@ struct _MailFilteringData
 
 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 22497d8..0fff0b1 100644 (file)
@@ -2157,12 +2157,8 @@ void summary_select_by_msg_list(SummaryView      *summaryview, GSList *msginfos)
 
        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;