2007-09-26 [colin] 3.0.1cvs32
authorColin Leroy <colin@colino.net>
Wed, 26 Sep 2007 08:40:55 +0000 (08:40 +0000)
committerColin Leroy <colin@colino.net>
Wed, 26 Sep 2007 08:40:55 +0000 (08:40 +0000)
* src/messageview.c
* src/procmsg.c
* src/procmsg.h
Optimisation: avoid fetching mail 3 times locally
for displaying

ChangeLog
PATCHSETS
configure.ac
src/messageview.c
src/procmsg.c
src/procmsg.h

index 6dd1e7348f454d846b5c700b6e3ce21a51a86faf..170107d654abe82d69390ee3027325ef7a75b07b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-26 [colin]     3.0.1cvs32
+
+       * src/messageview.c
+       * src/procmsg.c
+       * src/procmsg.h
+               Optimisation: avoid fetching mail 3 times locally
+               for displaying
+
 2007-09-26 [colin]     3.0.1cvs31
 
        * src/mh.c
index fe45c2fdb9a9e0ab3ecbe86d9b0114b4f38d6d84..e76302635ce74d3e403b047f8170417d2a72bf54 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.149.2.82 -r 1.149.2.83 src/inc.c;  ) > 3.0.1cvs29.patchset
 ( cvs diff -u -r 1.213.2.162 -r 1.213.2.163 src/folder.c;  cvs diff -u -r 1.87.2.48 -r 1.87.2.49 src/folder.h;  cvs diff -u -r 1.79.2.61 -r 1.79.2.62 src/mh.c;  cvs diff -u -r 1.9.2.7 -r 1.9.2.8 src/mh.h;  ) > 3.0.1cvs30.patchset
 ( cvs diff -u -r 1.79.2.62 -r 1.79.2.63 src/mh.c;  ) > 3.0.1cvs31.patchset
+( cvs diff -u -r 1.94.2.152 -r 1.94.2.153 src/messageview.c;  cvs diff -u -r 1.150.2.102 -r 1.150.2.103 src/procmsg.c;  cvs diff -u -r 1.60.2.48 -r 1.60.2.49 src/procmsg.h;  ) > 3.0.1cvs32.patchset
index 28e3dd6ea7c2827e55f35f8106b4bf9a9a727da6..814e32e1127b0d9eb1ca1ae9227e5e14b13f5556 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=31
+EXTRA_VERSION=32
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 8bbea0c036938f507a4759330b0168e28f4fc0fa..e753ff60ce574f0b49c194bc61c87b6bffd90c05 100644 (file)
@@ -822,10 +822,24 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                                procmsg_spam_can_learn());
        }
        messageview->updating = TRUE;
-       mimeinfo = procmime_scan_message(msginfo);
+
+       file = procmsg_get_message_file_path(msginfo);
+       if (!file) {
+               g_warning("can't get message file path.\n");
+               textview_show_error(messageview->mimeview->textview);
+               return -1;
+       }
+       
+       if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+           !folder_has_parent_of_type(msginfo->folder, F_DRAFT))
+               mimeinfo = procmime_scan_file(file);
+       else
+               mimeinfo = procmime_scan_queue_file(file);
+
        messageview->updating = FALSE;
        
        if (messageview->deferred_destroy) {
+               g_free(file);
                messageview_destroy(messageview);
                return 0;
        }
@@ -843,29 +857,13 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
                        break;
                }
        }
-       
-       messageview->updating = TRUE;
-       file = procmsg_get_message_file_path(msginfo);
-       messageview->updating = FALSE;
-       
-       if (messageview->deferred_destroy) {
-               g_free(file);
-               messageview_destroy(messageview);
-               return 0;
-       }
-
-       if (!file) {
-               g_warning("can't get message file path.\n");
-               procmime_mimeinfo_free_all(mimeinfo);
-               textview_show_error(messageview->mimeview->textview);
-               return -1;
-       }
-       
+                       
        if (messageview->msginfo != msginfo) {
                procmsg_msginfo_free(messageview->msginfo);
                messageview->msginfo = NULL;
                messageview_set_menu_sensitive(messageview);
-               messageview->msginfo = procmsg_msginfo_get_full_info(msginfo);
+               messageview->msginfo = 
+                       procmsg_msginfo_get_full_info_from_file(msginfo, file);
                if (!messageview->msginfo)
                        messageview->msginfo = procmsg_msginfo_copy(msginfo);
        } else {
index c3e4f26157231a4ada3a107aebca5625b255f09e..aaf9f65223bf902ac828e077fd41884349fa3f17 100644 (file)
@@ -1218,25 +1218,18 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo)
        return newmsginfo;
 }
 
-MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo)
+MsgInfo *procmsg_msginfo_get_full_info_from_file(MsgInfo *msginfo, const gchar *file)
 {
        MsgInfo *full_msginfo;
-       gchar *file;
 
        if (msginfo == NULL) return NULL;
 
-       file = procmsg_get_message_file_path(msginfo);
-       if (!file || !is_file_exist(file)) {
-               g_free(file);
-               file = procmsg_get_message_file(msginfo);
-       }
        if (!file || !is_file_exist(file)) {
-               g_warning("procmsg_msginfo_get_full_info(): can't get message file.\n");
+               g_warning("procmsg_msginfo_get_full_info_from_file(): can't get message file.\n");
                return NULL;
        }
 
        full_msginfo = procheader_parse_file(file, msginfo->flags, TRUE, FALSE);
-       g_free(file);
        if (!full_msginfo) return NULL;
 
        msginfo->total_size = full_msginfo->total_size;
@@ -1282,6 +1275,28 @@ MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo)
        return procmsg_msginfo_new_ref(msginfo);
 }
 
+MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo)
+{
+       MsgInfo *full_msginfo;
+       gchar *file;
+
+       if (msginfo == NULL) return NULL;
+
+       file = procmsg_get_message_file_path(msginfo);
+       if (!file || !is_file_exist(file)) {
+               g_free(file);
+               file = procmsg_get_message_file(msginfo);
+       }
+       if (!file || !is_file_exist(file)) {
+               g_warning("procmsg_msginfo_get_full_info(): can't get message file.\n");
+               return NULL;
+       }
+
+       full_msginfo = procmsg_msginfo_get_full_info_from_file(msginfo, file);
+       g_free(file);
+       return full_msginfo;
+}
+
 void procmsg_msginfo_free(MsgInfo *msginfo)
 {
        if (msginfo == NULL) return;
index 8ee667429af9fb0fe880566e8112212d1a221e08..ca26618fa4a30051474374f7257edb2378250097 100644 (file)
@@ -329,6 +329,9 @@ MsgInfo *procmsg_msginfo_new                ();
 MsgInfo *procmsg_msginfo_new_ref       (MsgInfo        *msginfo);
 MsgInfo *procmsg_msginfo_copy          (MsgInfo        *msginfo);
 MsgInfo *procmsg_msginfo_get_full_info (MsgInfo        *msginfo);
+MsgInfo *procmsg_msginfo_get_full_info_from_file
+                                       (MsgInfo *msginfo, 
+                                       const gchar *file);
 void    procmsg_msginfo_free           (MsgInfo        *msginfo);
 guint   procmsg_msginfo_memusage       (MsgInfo        *msginfo);