0.9.3claws45
authorChristoph Hohmann <reboot@gmx.ch>
Wed, 23 Jul 2003 14:51:47 +0000 (14:51 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Wed, 23 Jul 2003 14:51:47 +0000 (14:51 +0000)
* sync with 0.9.3cvs14 (incomplete)
        see ChangeLog 2003-07-17

ChangeLog.claws
configure.ac
src/folder.c
src/folder.h
src/imap.c
src/mbox_folder.c
src/mh.c
src/news.c
src/procmsg.c
src/procmsg.h
src/summaryview.c

index 53bdb49b2662051c564e4aa94816e27e33366cff..573cf5bafda17028f4d61f16c17cfda7c860fbb1 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-23 [christoph] 0.9.3claws45
+
+       * sync with 0.9.3cvs14 (incomplete)
+               see ChangeLog 2003-07-17
+
 2003-07-23 [alfons]    0.9.3claws44
 
        * src/folder.c
index 6cc60d6e3938f80d7426aac0aa2c624af767dcab..2f21c61cbaaefb7e54814c84f375bb5c6ba27e8e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=44
+EXTRA_VERSION=45
 VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws${EXTRA_VERSION}
 
 dnl set $target
index 7e5a0966aa304d9da14a1f3122ae1fe167e1e466..090d048e284495b03ba96df304e8c2141d231900 100644 (file)
@@ -1694,6 +1694,30 @@ gint folder_item_add_msg(FolderItem *dest, const gchar *file,
        return num;
 }
 
+gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
+                          gboolean remove_source, gint *first)
+{
+        Folder *folder;
+        gint num;
+
+        g_return_val_if_fail(dest != NULL, -1);
+        g_return_val_if_fail(file_list != NULL, -1);
+        g_return_val_if_fail(dest->folder != NULL, -1);
+        g_return_val_if_fail(dest->folder->klass->add_msgs != NULL, -1);
+
+        folder = dest->folder;
+
+        num = folder->klass->add_msgs(folder, dest, file_list, remove_source, first);
+
+       /*
+         * TODO: Claws should get feedback about each message
+        *       remove source done here in claws, not in folder
+         *       function
+        */
+       
+        return num;
+}
+
 /*
 gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
 {
index fc8f2230d6d5de35c06f92c78c66b4225492f304..5360f64359db3ea180be34a51515d9f680f07d80 100644 (file)
@@ -217,7 +217,12 @@ struct _FolderClass
        gint            (*add_msg)              (Folder         *folder,
                                                 FolderItem     *dest,
                                                 const gchar    *file,
-                                               gboolean         remove_source);
+                                                gboolean        remove_source);
+       gint            (*add_msgs)             (Folder         *folder,
+                                                FolderItem     *dest,
+                                                GSList         *file_list,
+                                                gboolean        remove_source,
+                                                gint           *first);
        gint            (*copy_msg)             (Folder         *folder,
                                                 FolderItem     *dest,
                                                 MsgInfo        *msginfo);
@@ -414,6 +419,10 @@ gchar *folder_item_fetch_msg               (FolderItem     *item,
 gint   folder_item_add_msg             (FolderItem     *dest,
                                         const gchar    *file,
                                         gboolean        remove_source);
+gint   folder_item_add_msgs             (FolderItem     *dest,
+                                         GSList         *file_list,
+                                         gboolean        remove_source,
+                                         gint           *first);
 gint   folder_item_move_to             (FolderItem     *src,
                                         FolderItem     *dest,
                                         FolderItem    **new_item);
index fd890dd7736dcf14f78c283f18d9c6a7c1770167..7029facbdda765de54be527a361a3f1382bfc360 100644 (file)
@@ -431,6 +431,7 @@ FolderClass imap_class =
        imap_get_msginfos,
        imap_fetch_msg,
        imap_add_msg,
+       NULL,
        imap_copy_msg,
        imap_remove_msg,
        imap_remove_all_msg,
index c266bb75d8fa7ba8e6c5b4e6dbe9d54d390238a8..74af8d60cf1ffb7ab36c0046be44cd1db6182826 100644 (file)
@@ -102,6 +102,7 @@ FolderClass mbox_class =
        NULL,
        mbox_fetch_msg,
        mbox_add_msg,
+       NULL,
        mbox_copy_msg,
        mbox_remove_msg,
        mbox_remove_all_msg,
index 5c3d8fd8f86435a46691bca5ff7799de14088a89..5db3c3cce7d9d733579177460f2e2f101284f983 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -54,6 +54,11 @@ static MsgInfo *mh_get_msginfo(Folder * folder,
 static gint mh_add_msg(Folder * folder,
                       FolderItem * dest,
                       const gchar * file, gboolean remove_source);
+gint     mh_add_msgs           (Folder         *folder,
+                                FolderItem     *dest,
+                                GSList         *file_list,
+                                gboolean        remove_source,
+                                gint           *first);
 static gint mh_copy_msg(Folder * folder,
                        FolderItem * dest, MsgInfo * msginfo);
 static gint mh_remove_msg(Folder * folder, FolderItem * item, gint num);
@@ -111,6 +116,7 @@ FolderClass mh_class =
        NULL,
        mh_fetch_msg,
        mh_add_msg,
+       mh_add_msgs,
        mh_copy_msg,
        mh_remove_msg,
        mh_remove_all_msg,
@@ -308,36 +314,65 @@ gchar *mh_get_new_msg_filename(FolderItem *dest)
 gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
                gboolean remove_source)
 {
+        GSList file_list; 
+  
+        g_return_val_if_fail(file != NULL, -1); 
+  
+        file_list.data = (gpointer) file; 
+        file_list.next = NULL; 
+  
+        return mh_add_msgs(folder, dest, &file_list, remove_source, NULL); 
+} 
+gint mh_add_msgs(Folder *folder, FolderItem *dest, GSList *file_list, 
+                gboolean remove_source, gint *first) 
+{ 
        gchar *destfile;
+        GSList *cur; 
+        gchar *file; 
+        gint first_ = 0; 
 
        g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(file != NULL, -1);
+       g_return_val_if_fail(file_list != NULL, -1);
 
        if (dest->last_num < 0) {
                mh_get_last_num(folder, dest);
                if (dest->last_num < 0) return -1;
        }
 
-       destfile = mh_get_new_msg_filename(dest);
-       g_return_val_if_fail(destfile != NULL, -1);
-
-       if (link(file, destfile) < 0) {
-               if (copy_file(file, destfile, TRUE) < 0) {
-                       g_warning("can't copy message %s to %s\n",
-                                 file, destfile);
-                       g_free(destfile);
-                       return -1;
+        for (cur = file_list; cur != NULL; cur = cur->next) { 
+                file = (gchar *)cur->data; 
+
+                destfile = mh_get_new_msg_filename(dest); 
+                if (destfile == NULL) return -1; 
+                if (first_ == 0 || first_ > dest->last_num + 1) 
+                        first_ = dest->last_num + 1; 
+  
+                if (link(file, destfile) < 0) { 
+                        if (copy_file(file, destfile, TRUE) < 0) { 
+                                g_warning(_("can't copy message %s to %s\n"), 
+                                          file, destfile); 
+                                g_free(destfile); 
+                                return -1; 
+                        } 
                }
+
+               g_free(destfile);
+               dest->last_num++;
        }
 
+       if (first)
+               *first = first_;
+
        if (remove_source) {
-               if (unlink(file) < 0)
-                       FILE_OP_ERROR(file, "unlink");
+               for (cur = file_list; cur != NULL; cur = cur->next) {
+                       file = (gchar *)cur->data;
+                       if (unlink(file) < 0)
+                               FILE_OP_ERROR(file, "unlink");
+               }
        }
 
-       g_free(destfile);
-       dest->last_num++;
-       return dest->last_num;
+       return dest->last_num; 
 }
 
 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
index df017fe548cf50bc65cb56c6676f8e7b186c6820..49cd8468b6e09543205cc4153f2fc28066ac2514 100644 (file)
@@ -146,6 +146,7 @@ FolderClass news_class =
        NULL,
        NULL,
        NULL,
+       NULL,
 };
 
 FolderClass *news_get_class(void)
index 48afc450f35d9368ba71cebfe8d02356ffb85c82..6bd720d3ea23a7559f664701463a541c12a332f2 100644 (file)
@@ -382,6 +382,29 @@ gchar *procmsg_get_message_file(MsgInfo *msginfo)
        return filename;
 }
 
+GSList *procmsg_get_message_file_list(MsgInfoList *mlist)
+{
+       GSList *file_list = NULL;
+       MsgInfo *msginfo;
+       gchar *file;
+
+       while (mlist != NULL) {
+               msginfo = (MsgInfo *)mlist->data;
+               file = procmsg_get_message_file(msginfo);
+               if (!file) {
+                       slist_free_strings(file_list);
+                       g_slist_free(file_list);
+                       return NULL;
+               }
+               file_list = g_slist_prepend(file_list, file);
+               mlist = mlist->next;
+       }
+
+       file_list = g_slist_reverse(file_list);
+
+       return file_list;
+}
+
 FILE *procmsg_open_message(MsgInfo *msginfo)
 {
        FILE *fp;
index fef815ffd82ef605adcf3add8240a41789bf9297..a2f3ffe3091e6126a8f572c5af7556b1e544daf0 100644 (file)
@@ -227,6 +227,7 @@ void        procmsg_copy_messages           (GSList         *mlist);
 
 gchar  *procmsg_get_message_file_path  (MsgInfo        *msginfo);
 gchar  *procmsg_get_message_file       (MsgInfo        *msginfo);
+GSList *procmsg_get_message_file_list  (MsgInfoList    *mlist);
 FILE   *procmsg_open_message           (MsgInfo        *msginfo);
 #if USE_GPGME
 FILE   *procmsg_open_message_decrypted (MsgInfo        *msginfo,
index 33466197e19045fde48531441b7c51ef34a4faa7..381876f7263e0556946f6d751c210aadb4ed7489 100644 (file)
@@ -1254,15 +1254,32 @@ SummarySelection summary_get_selection_type(SummaryView *summaryview)
 GSList *summary_get_selected_msg_list(SummaryView *summaryview)
 {
        GSList *mlist = NULL;
-       GList *row_list;
        GList *cur;
        MsgInfo *msginfo;
 
-       row_list = GTK_CLIST(summaryview->ctree)->selection;
-       for (cur = row_list; cur != NULL; cur = cur->next) {
-               msginfo = gtk_ctree_node_get_row_data
-                       (GTK_CTREE(summaryview->ctree),
-                        GTK_CTREE_NODE(cur->data));
+       for (cur = GTK_CLIST(summaryview->ctree)->selection; cur != NULL;
+            cur = cur->next) {
+               msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(cur->data);
+               mlist = g_slist_prepend(mlist, msginfo);
+       }
+
+       mlist = g_slist_reverse(mlist);
+
+       return mlist;
+}
+
+GSList *summary_get_msg_list(SummaryView *summaryview)
+{
+       GSList *mlist = NULL;
+       GtkCTree *ctree;
+       GtkCTreeNode *node;
+       MsgInfo *msginfo;
+
+       ctree = GTK_CTREE(summaryview->ctree);
+
+       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+            node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
+               msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
                mlist = g_slist_prepend(mlist, msginfo);
        }
 
@@ -2438,7 +2455,6 @@ static void summary_display_msg_full(SummaryView *summaryview,
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        MsgInfo *msginfo;
        MsgFlags flags;
-       gchar *filename;
 
        if (!new_window) {
                if (summaryview->displayed == row)
@@ -2457,13 +2473,6 @@ static void summary_display_msg_full(SummaryView *summaryview,
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
 
-       filename = procmsg_get_message_file(msginfo);
-       if (!filename) {
-               summary_unlock(summaryview);
-               return;
-       }
-       g_free(filename);
-
        if (new_window || !prefs_common.mark_as_read_on_new_window) {
                if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                        summaryview->newmsgs--;
@@ -2709,9 +2718,6 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
                }
                        gtk_ctree_node_set_foreground
                                (ctree, row, &summaryview->color_dim);
-       } else if (MSG_IS_MARKED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MARK],
-                                         markxpm, markxpmmask);
        } else if (MSG_IS_MOVE(flags)) {
                gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_MARK], "o");
                if (style)
@@ -2730,14 +2736,16 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
                }
                        gtk_ctree_node_set_foreground
                                (ctree, row, &summaryview->color_marked);
-       }
-       else if ((global_scoring ||
+       } else if ((global_scoring ||
                  summaryview->folder_item->prefs->scoring) &&
                 (msginfo->score >= summaryview->important_score) &&
                 (MSG_IS_MARKED(msginfo->flags) || MSG_IS_MOVE(msginfo->flags) || MSG_IS_COPY(msginfo->flags))) {
                gtk_ctree_node_set_text(ctree, row, S_COL_MARK, "!");
                gtk_ctree_node_set_foreground(ctree, row,
                                              &summaryview->color_important);
+       } else if (MSG_IS_MARKED(flags)) {
+               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MARK],
+                                         markxpm, markxpmmask);
        } else {
                gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_MARK], NULL);
        }
@@ -3176,10 +3184,12 @@ static void summary_delete_duplicated_func(GtkCTree *ctree, GtkCTreeNode *node,
                                           SummaryView *summaryview)
 {
        GtkCTreeNode *found;
-       MsgInfo *msginfo = GTK_CTREE_ROW(node)->row.data;
+       MsgInfo *msginfo;
        MsgInfo *dup_msginfo;
+
+       msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
        
-       if (!msginfo->msgid || !*msginfo->msgid) return;
+       if (!msginfo || !msginfo->msgid || !*msginfo->msgid) return;
 
        found = g_hash_table_lookup(summaryview->msgid_table, msginfo->msgid);
        
@@ -3627,7 +3637,7 @@ static void summary_execute_move_func(GtkCTree *ctree, GtkCTreeNode *node,
 
        if (msginfo && MSG_IS_MOVE(msginfo->flags) && msginfo->to_folder) {
                summaryview->mlist =
-                       g_slist_append(summaryview->mlist, msginfo);
+                       g_slist_prepend(summaryview->mlist, msginfo);
                gtk_ctree_node_set_row_data(ctree, node, NULL);
 
                if (msginfo->msgid && *msginfo->msgid &&
@@ -3647,6 +3657,7 @@ static void summary_execute_copy(SummaryView *summaryview)
                                summaryview);
 
        if (summaryview->mlist) {
+               summaryview->mlist = g_slist_reverse(summaryview->mlist);
                procmsg_copy_messages(summaryview->mlist);
 
                g_slist_free(summaryview->mlist);
@@ -3664,7 +3675,7 @@ static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
 
        if (msginfo && MSG_IS_COPY(msginfo->flags) && msginfo->to_folder) {
                summaryview->mlist =
-                       g_slist_append(summaryview->mlist, msginfo);
+                       g_slist_prepend(summaryview->mlist, msginfo);
 
                procmsg_msginfo_unset_flags(msginfo, 0, MSG_COPY);
                summary_set_row_marks(summaryview, node);
@@ -4652,10 +4663,15 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
 
        switch (column < 0 ? column : summaryview->col_state[column].type) {
        case S_COL_MARK:
-               if (MSG_IS_MARKED(msginfo->flags)) {
-                       summary_unmark_row(summaryview, row);
-               } else
-                       summary_mark_row(summaryview, row);
+               if (!MSG_IS_DELETED(msginfo->flags) &&
+                   !MSG_IS_MOVE(msginfo->flags) &&
+                   !MSG_IS_COPY(msginfo->flags)) {
+                       if (MSG_IS_MARKED(msginfo->flags)) {
+                               summary_unmark_row(summaryview, row);
+                       } else {
+                               summary_mark_row(summaryview, row);
+                       }
+               }
                break;
        case S_COL_STATUS:
                if (MSG_IS_UNREAD(msginfo->flags)) {