2006-06-26 [colin] 2.3.1cvs21
authorColin Leroy <colin@colino.net>
Mon, 26 Jun 2006 16:37:01 +0000 (16:37 +0000)
committerColin Leroy <colin@colino.net>
Mon, 26 Jun 2006 16:37:01 +0000 (16:37 +0000)
* src/mbox.c
More feedback (and optimisation)
on import/export
* src/common/utils.c
Fix case when looking for mail addresses
* src/gtk/gtkutils.c
Extra check for (X-)Face

ChangeLog
PATCHSETS
configure.ac
src/common/utils.c
src/gtk/gtkutils.c
src/mbox.c

index 8dee983313f2f0d9ea4d491aab32becc899d9a66..c22879b8ddda29bac3b753ba4d9da9337121296f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-06-26 [colin]     2.3.1cvs21
+
+       * src/mbox.c
+               More feedback (and optimisation)
+               on import/export
+       * src/common/utils.c
+               Fix case when looking for mail addresses
+       * src/gtk/gtkutils.c
+               Extra check for (X-)Face
+
 2006-06-25 [ticho]     2.3.1cvs20
 
        * src/compose.c
index 61a618b2784249cfdfd3ce0090a9aa2fc2682d43..ac79f2424f58c43e0b5df3168fbb9f2ae3cabcef 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.204.2.90 -r 1.204.2.91 src/prefs_common.c;  ) > 2.3.1cvs18.patchset
 ( cvs diff -u -r 1.382.2.285 -r 1.382.2.286 src/compose.c;  cvs diff -u -r 1.20.2.8 -r 1.20.2.9 src/gtk/Makefile.am;  diff -u /dev/null src/gtk/combobox.c;  diff -u /dev/null src/gtk/combobox.h;  cvs diff -u -r 1.5.2.28 -r 1.5.2.29 src/gtk/gtkutils.c;  cvs diff -u -r 1.4.2.20 -r 1.4.2.21 src/gtk/gtkutils.h;  ) > 2.3.1cvs19.patchset
 ( cvs diff -u -r 1.382.2.286 -r 1.382.2.287 src/compose.c;  cvs diff -u -r 1.3.2.16 -r 1.3.2.17 src/exphtmldlg.c;  cvs diff -u -r 1.5.2.29 -r 1.5.2.30 src/gtk/gtkutils.c;  cvs diff -u -r 1.4.2.21 -r 1.4.2.22 src/gtk/gtkutils.h;  ) > 2.3.1cvs20.patchset
+( cvs diff -u -r 1.28.2.18 -r 1.28.2.19 src/mbox.c;  cvs diff -u -r 1.36.2.67 -r 1.36.2.68 src/common/utils.c;  cvs diff -u -r 1.5.2.30 -r 1.5.2.31 src/gtk/gtkutils.c;  ) > 2.3.1cvs21.patchset
index 137c713297a397add715456f6c9e1ef26c34c4c5..04de4afd59f4985764cfed7d4737748f1d12ced1 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=3
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=20
+EXTRA_VERSION=21
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 37efc5aa86afbe4ab965adb84002907ed76bfe3c..1ec2b08a01931cc375e97b6b6e3b6b5ff23ef9b8 100644 (file)
@@ -3848,8 +3848,7 @@ guint g_stricase_hash(gconstpointer gptr)
        const char *str;
 
        for (str = gptr; str && *str; str++) {
-               if (isupper((guchar)*str)) hash_result += (*str + ' ');
-               else hash_result += *str;
+               hash_result += toupper(*str);
        }
 
        return hash_result;
@@ -3860,7 +3859,7 @@ gint g_stricase_equal(gconstpointer gptr1, gconstpointer gptr2)
        const char *str1 = gptr1;
        const char *str2 = gptr2;
 
-       return !g_utf8_collate(str1, str2);
+       return !strcasecmp(str1, str2);
 }
 
 gint g_int_compare(gconstpointer a, gconstpointer b)
index 6c009d0fd908fc1f1b09ab217526a676314a3b49..5eee74595552befeda702c4d5988d444d1d384b0 100644 (file)
@@ -1147,6 +1147,9 @@ GtkWidget *face_get_from_header(const gchar *o_face)
        GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
        GtkWidget *image;
        
+       if (o_face == NULL || strlen(o_face) == 0)
+               return NULL;
+
        strncpy2(face, o_face, sizeof(face));
 
        unfold_line(face); /* strip all whitespace and linebreaks */
index 26cea303dcc19a6d10092234b7b78098a33a6705..23a70433eeb4062f50c9fdaac0a6d4bc47393014 100644 (file)
@@ -43,6 +43,7 @@
 #include "utils.h"
 #include "filtering.h"
 #include "alertpanel.h"
+#include "statusbar.h"
 
 #define MSGBUFSIZE     8192
 
@@ -69,7 +70,9 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter)
        gint lines;
        MsgInfo *msginfo;
        gboolean more;
-       GSList *to_filter = NULL, *cur;
+       GSList *to_filter = NULL, *to_drop = NULL, *cur, *to_add = NULL;
+       gboolean printed = FALSE;
+       FolderItem *dropfolder;
 
        g_return_val_if_fail(dest != NULL, -1);
        g_return_val_if_fail(mbox != NULL, -1);
@@ -100,13 +103,25 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter)
        tmp_file = get_tmp_file();
 
        folder_item_update_freeze();
+
+       if (apply_filter)
+               dropfolder = folder_get_default_processing();
+       else
+               dropfolder = dest;
        
        do {
                FILE *tmp_fp;
-               FolderItem *dropfolder;
                gint empty_lines;
                gint msgnum;
-
+               
+               if (msgs > 0 && msgs%500 == 0) {
+                       if (printed)
+                               statusbar_pop_all();
+                       statusbar_print_all(_("Importing from mbox... (%d mails imported)"), msgs);
+                       printed=TRUE;
+                       GTK_EVENTS_FLUSH();
+               }
+       
                if ((tmp_fp = g_fopen(tmp_file, "wb")) == NULL) {
                        FILE_OP_ERROR(tmp_file, "fopen");
                        g_warning("can't open temporary file\n");
@@ -203,29 +218,59 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter)
                        return -1;
                }
 
-               dropfolder = folder_get_default_processing();
+               if (apply_filter) {
+                       if ((msgnum = folder_item_add_msg(dropfolder, tmp_file, NULL, TRUE)) < 0) {
+                               fclose(mbox_fp);
+                               g_unlink(tmp_file);
+                               g_free(tmp_file);
+                               return -1;
+                       }
+                       msginfo = folder_item_get_msginfo(dropfolder, msgnum);
+                       if (!procmsg_msginfo_filter(msginfo))
+                               to_drop = g_slist_prepend(to_drop, msginfo);
+                       else
+                               to_filter = g_slist_prepend(to_filter, msginfo);
+               } else {
+                       MsgFileInfo *finfo = g_new0(MsgFileInfo, 1);
+                       finfo->file = tmp_file;
                        
-               if ((msgnum = folder_item_add_msg(dropfolder, tmp_file, NULL, TRUE)) < 0) {
-                       fclose(mbox_fp);
-                       g_unlink(tmp_file);
-                       g_free(tmp_file);
-                       return -1;
+                       to_add = g_slist_prepend(to_add, finfo);
+                       tmp_file = get_tmp_file();
+                       
+                       /* flush every 500 */
+                       if (msgs > 0 && msgs % 500 == 0) {
+                               folder_item_add_msgs(dropfolder, to_add, TRUE);
+                               procmsg_message_file_list_free(to_add);
+                               to_add = NULL;
+                       }
                }
-
-               msginfo = folder_item_get_msginfo(dropfolder, msgnum);
-                if (!apply_filter || !procmsg_msginfo_filter(msginfo)) {
-                       folder_item_move_msg(dest, msginfo);
-                       procmsg_msginfo_free(msginfo);
-               } else
-                       to_filter = g_slist_append(to_filter, msginfo);
-
                msgs++;
        } while (more);
 
-       filtering_move_and_copy_msgs(to_filter);
-       for (cur = to_filter; cur; cur = g_slist_next(cur)) {
-               MsgInfo *info = (MsgInfo *)cur->data;
-               procmsg_msginfo_free(info);
+       if (printed)
+               statusbar_pop_all();
+
+       if (apply_filter) {
+               to_drop = g_slist_reverse(to_drop);
+               folder_item_move_msgs(dest, to_drop);
+               for (cur = to_drop; cur; cur = g_slist_next(cur)) {
+                       MsgInfo *info = (MsgInfo *)cur->data;
+                       procmsg_msginfo_free(info);
+               }
+
+               to_drop = g_slist_reverse(to_filter);
+               filtering_move_and_copy_msgs(to_filter);
+               for (cur = to_filter; cur; cur = g_slist_next(cur)) {
+                       MsgInfo *info = (MsgInfo *)cur->data;
+                       procmsg_msginfo_free(info);
+               }
+
+               g_slist_free(to_drop);
+               g_slist_free(to_filter);
+       } else if (to_add) {
+               folder_item_add_msgs(dropfolder, to_add, TRUE);
+               procmsg_message_file_list_free(to_add);
+               to_add = NULL;
        }
 
        folder_item_update_thaw();
@@ -417,7 +462,7 @@ gint export_list_to_mbox(GSList *mlist, const gchar *mbox)
        FILE *msg_fp;
        FILE *mbox_fp;
        gchar buf[BUFFSIZE];
-
+       gint msgs = 1, total = g_slist_length(mlist);
        if (g_file_test(mbox, G_FILE_TEST_EXISTS) == TRUE) {
                if (alertpanel_full(_("Overwrite mbox file"),
                                        _("This file already exists. Do you want to overwrite it?"),
@@ -434,6 +479,7 @@ gint export_list_to_mbox(GSList *mlist, const gchar *mbox)
                return -1;
        }
 
+       statusbar_print_all(_("Exporting to mbox..."));
        for (cur = mlist; cur != NULL; cur = cur->next) {
                msginfo = (MsgInfo *)cur->data;
                int len;
@@ -484,8 +530,13 @@ gint export_list_to_mbox(GSList *mlist, const gchar *mbox)
 
                fclose(msg_fp);
                procmsg_msginfo_free(msginfo);
+               statusbar_progress_all(msgs++,total, 500);
+               if (msgs%500 == 0)
+                       GTK_EVENTS_FLUSH();
        }
-       
+       statusbar_progress_all(0,0,0);
+       statusbar_pop_all();
+
        fclose(mbox_fp);
 
        return 0;