* src/mh.c
authorChristoph Hohmann <reboot@gmx.ch>
Tue, 19 Mar 2002 22:45:48 +0000 (22:45 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Tue, 19 Mar 2002 22:45:48 +0000 (22:45 +0000)
* src/procmsg.[ch]
* src/summaryview.c
        revert changes for flag updates
        (does not work correctly and no time to debug)

ChangeLog.claws
configure.in
src/mh.c
src/procmsg.c
src/procmsg.h
src/summaryview.c

index acde0b4..89feda2 100644 (file)
@@ -1,3 +1,11 @@
+2002-03-19 [christoph] 0.7.4claws26
+
+       * src/mh.c
+       * src/procmsg.[ch]
+       * src/summaryview.c
+               revert changes for flag updates
+               (does not work correctly and no time to debug)
+
 2002-03-20 [alfons]    0.7.4claws25
 
        * src/pop.c
index 3a4bcf6..d17f2d9 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws25
+EXTRA_VERSION=claws26
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 5803033..384303b 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -652,7 +652,6 @@ gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
 gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
 {
        gchar *file;
-       MsgInfo *msginfo;
 
        g_return_val_if_fail(item != NULL, -1);
 
@@ -665,15 +664,6 @@ gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
                return -1;
        }
 
-       if(msginfo = g_new0(MsgInfo, 1)) {
-               msginfo->msgnum = num;
-               msginfo->flags.perm_flags = MSG_REALLY_DELETED;
-               msginfo->folder = item;
-
-               procmsg_msginfo_write_flags(msginfo);
-               g_free(msginfo);
-       }
-       
        g_free(file);
        return 0;
 }
index 7254922..9fa17a8 100644 (file)
@@ -469,12 +469,8 @@ static GHashTable *procmsg_read_mark_file(const gchar *folder)
 
                flags = g_new0(MsgFlags, 1);
                flags->perm_flags = perm_flags;
-    
-               if(!MSG_IS_REALLY_DELETED(*flags)) {
-                       g_hash_table_insert(mark_table, GUINT_TO_POINTER(num), flags);
-               } else {
-                       g_hash_table_remove(mark_table, GUINT_TO_POINTER(num));
-               }
+
+               g_hash_table_insert(mark_table, GUINT_TO_POINTER(num), flags);
        }
 
        fclose(fp);
@@ -548,7 +544,7 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                                parent = root;
                        } else {
                                if(MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags)) {
-                                       procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
+                                       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
                                }
                        }
                }
@@ -579,7 +575,7 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                                (parent, parent->children, node);
                        /* CLAWS: ignore thread */
                        if(MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags)) {
-                               procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
+                               MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
                        }
                }
                node = next;
@@ -610,7 +606,7 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                                g_node_append(parent, node);
                                /* CLAWS: ignore thread */
                                if(MSG_IS_IGNORE_THREAD(((MsgInfo *)parent->data)->flags)) {
-                                       procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
+                                       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
                                }
                        }
                }                                       
@@ -1234,122 +1230,3 @@ gint procmsg_send_message_queue(const gchar *file)
 
        return (newsval != 0 ? newsval : mailval);
 }
-
-#define CHANGE_FLAGS(msginfo) \
-{ \
-if (msginfo->folder->folder->change_flags != NULL) \
-msginfo->folder->folder->change_flags(msginfo->folder->folder, \
-                                     msginfo->folder, \
-                                     msginfo); \
-}
-
-void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmpFlags tmp_flags)
-{
-       gboolean changed = FALSE;
-       FolderItem *item = msginfo->folder;
-
-       debug_print(_("Setting flags for message %d in folder %s\n"), msginfo->msgnum, item->path);
-
-       /* if new flag is set */
-       if((perm_flags & MSG_NEW) && !MSG_IS_NEW(msginfo->flags) &&
-          !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
-               item->new++;
-               changed = TRUE;
-       }
-
-       /* if unread flag is set */
-       if((perm_flags & MSG_UNREAD) && !MSG_IS_UNREAD(msginfo->flags) &&
-          !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
-               item->unread++;
-               changed = TRUE;
-       }
-
-       /* if ignore thread flag is set */
-       if((perm_flags & MSG_IGNORE_THREAD) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
-               if(MSG_IS_NEW(msginfo->flags) || (perm_flags & MSG_NEW)) {
-                       item->new--;
-                       changed = TRUE;
-               }
-               if(MSG_IS_UNREAD(msginfo->flags) || (perm_flags & MSG_UNREAD)) {
-                       item->unread--;
-                       changed = TRUE;
-               }
-       }
-
-       if (MSG_IS_IMAP(msginfo->flags))
-               imap_msg_set_perm_flags(msginfo, perm_flags);
-
-       msginfo->flags.perm_flags |= perm_flags;
-       msginfo->flags.tmp_flags |= tmp_flags;
-
-       if(changed) {
-               folderview_update_item(item, FALSE);
-       }
-       CHANGE_FLAGS(msginfo);
-       procmsg_msginfo_write_flags(msginfo);
-}
-
-void procmsg_msginfo_unset_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmpFlags tmp_flags)
-{
-       gboolean changed = FALSE;
-       FolderItem *item = msginfo->folder;
-       
-       debug_print(_("Unsetting flags for message %d in folder %s\n"), msginfo->msgnum, item->path);
-
-       /* if new flag is unset */
-       if((perm_flags & MSG_NEW) && MSG_IS_NEW(msginfo->flags) &&
-          !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
-               item->new--;
-               changed = TRUE;
-       }
-
-       /* if unread flag is unset */
-       if((perm_flags & MSG_UNREAD) && MSG_IS_UNREAD(msginfo->flags) &&
-          !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
-               item->unread--;
-               changed = TRUE;
-       }
-
-       /* if ignore thread flag is unset */
-       if((perm_flags & MSG_IGNORE_THREAD) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
-               if(MSG_IS_NEW(msginfo->flags) || (perm_flags & MSG_NEW)) {
-                       item->new++;
-                       changed = TRUE;
-               }
-               if(MSG_IS_UNREAD(msginfo->flags) || (perm_flags & MSG_UNREAD)) {
-                       item->unread++;
-                       changed = TRUE;
-               }
-       }
-
-       if (MSG_IS_IMAP(msginfo->flags))
-               imap_msg_unset_perm_flags(msginfo, perm_flags);
-
-       msginfo->flags.perm_flags &= ~perm_flags;
-       msginfo->flags.tmp_flags &= ~tmp_flags;
-
-       if(changed) {
-               folderview_update_item(item, FALSE);
-       }
-       CHANGE_FLAGS(msginfo);
-       procmsg_msginfo_write_flags(msginfo);
-}
-
-void procmsg_msginfo_write_flags(MsgInfo *msginfo)
-{
-       gchar *destdir;
-       FILE *fp;
-
-       destdir = folder_item_get_path(msginfo->folder);
-       if (!is_dir_exist(destdir))
-               make_dir_hier(destdir);
-
-       if ((fp = procmsg_open_mark_file(destdir, TRUE))) {
-               procmsg_write_flags(msginfo, fp);
-               fclose(fp);
-       } else {
-               g_warning(_("Can't open mark file.\n"));
-       }
-       
-       g_free(destdir);
-}
index f2043a1..6895c2a 100644 (file)
@@ -122,9 +122,6 @@ typedef enum
 #define MSG_SET_COLORLABEL_VALUE(msg, val) \
        MSG_SET_PERM_FLAGS(msg, ((((guint)(val)) & 7) << MSG_CLABEL_SBIT))
 
-#define MSG_COLORLABEL_TO_FLAGS(val) ((((guint)(val)) & 7) << MSG_CLABEL_SBIT)
-#define MSG_COLORLABEL_FROM_FLAGS(val) (val >> MSG_CLABEL_SBIT)
-
 #define MSG_IS_MOVE(msg)               (((msg).tmp_flags & MSG_MOVE) != 0)
 #define MSG_IS_COPY(msg)               (((msg).tmp_flags & MSG_COPY) != 0)
 
@@ -256,11 +253,4 @@ gint procmsg_cmp_msgnum_for_sort   (gconstpointer   a,
                                         gconstpointer   b);
 gint procmsg_send_message_queue                (const gchar *file);
 
-void procmsg_msginfo_set_flags         (MsgInfo *msginfo,
-                                        MsgPermFlags perm_flags,
-                                         MsgTmpFlags tmp_flags);
-void procmsg_msginfo_unset_flags       (MsgInfo *msginfo,
-                                        MsgPermFlags perm_flags,
-                                         MsgTmpFlags tmp_flags);
-
 #endif /* __PROCMSG_H__ */
index ff17523..88b1bb4 100644 (file)
@@ -847,12 +847,6 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
 
        g_slist_free(mlist);
 
-       summaryview->folder_item->new    = summaryview->newmsgs;
-       summaryview->folder_item->unread = summaryview->unread;
-       summaryview->folder_item->total  = summaryview->messages;
-       folderview_update_msg_num(summaryview->folderview,
-                                 summaryview->folderview->opened);
-
        summary_write_cache(summaryview);
 
        gtk_signal_handler_unblock_by_data(GTK_OBJECT(ctree), summaryview);
@@ -1678,10 +1672,6 @@ static void summary_status_show(SummaryView *summaryview)
                return;
        }
 
-       summaryview->newmsgs    = summaryview->folder_item->new;
-       summaryview->unread     = summaryview->folder_item->unread;
-       summaryview->messages   = summaryview->folder_item->total;
-
        rowlist = GTK_CLIST(summaryview->ctree)->selection;
        for (cur = rowlist; cur != NULL; cur = cur->next) {
                msginfo = gtk_ctree_node_get_row_data
@@ -1755,6 +1745,13 @@ static void summary_status_show(SummaryView *summaryview)
        }
        gtk_label_set(GTK_LABEL(summaryview->statlabel_msgs), str);
        g_free(str);
+
+       summaryview->folder_item->new    = summaryview->newmsgs;
+       summaryview->folder_item->unread = summaryview->unread;
+       summaryview->folder_item->total  = summaryview->messages;
+
+       folderview_update_msg_num(summaryview->folderview,
+                                 summaryview->folderview->opened);
 }
 
 static void summary_set_column_titles(SummaryView *summaryview)
@@ -2310,16 +2307,19 @@ static void summary_display_msg_full(SummaryView *summaryview,
        }
        g_free(filename);
 
-/* NOT NEEDED ANYMORE
        if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->newmsgs--;
        if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->unread--;
-*/
-       procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
-       summary_set_row_marks(summaryview, row);
-       gtk_clist_thaw(GTK_CLIST(ctree));
-       summary_status_show(summaryview);
+       if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags) || 
+           MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
+               MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
+               if (MSG_IS_IMAP(msginfo->flags))
+                       imap_msg_unset_perm_flags(msginfo, MSG_NEW | MSG_UNREAD);
+               summary_set_row_marks(summaryview, row);
+               gtk_clist_thaw(GTK_CLIST(ctree));
+               summary_status_show(summaryview);
+       }
 
        flags = msginfo->flags;
 
@@ -2347,6 +2347,14 @@ static void summary_display_msg_full(SummaryView *summaryview,
                gtkut_ctree_node_move_if_on_the_edge(ctree, row);
        }
 
+       if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags) ||
+           (MSG_IS_MIME(msginfo->flags) - MSG_IS_MIME(flags) != 0)) {
+               MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
+               CHANGE_FLAGS(msginfo);
+               summary_set_row_marks(summaryview, row);
+               gtk_clist_thaw(GTK_CLIST(ctree));
+               summary_status_show(summaryview);
+       }
        summary_set_menu_sensitive(summaryview);
        main_window_set_toolbar_sensitive(summaryview->mainwin);
 
@@ -2709,8 +2717,12 @@ static void summary_mark_row(SummaryView *summaryview, GtkCTreeNode *row)
                        folderview_update_item(msginfo->to_folder, 0);
        }
        msginfo->to_folder = NULL;
-       procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
-       procmsg_msginfo_set_flags(msginfo, MSG_MARKED, 0);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
+       MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
+       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_MARKED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_set_perm_flags(msginfo, MSG_MARKED);
+       CHANGE_FLAGS(msginfo);
        summary_set_row_marks(summaryview, row);
        debug_print(_("Message %s/%d is marked\n"), msginfo->folder->path, msginfo->msgnum);
 }
@@ -2739,8 +2751,12 @@ static void summary_lock_row(SummaryView *summaryview, GtkCTreeNode *row)
                        folderview_update_item(msginfo->to_folder, 0);
        }
        msginfo->to_folder = NULL;
-       procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, MSG_MOVE | MSG_COPY);
-       procmsg_msginfo_set_flags(msginfo, MSG_LOCKED, 0);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
+       MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
+       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_LOCKED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_set_perm_flags(msginfo, MSG_LOCKED);
+       CHANGE_FLAGS(msginfo);
        summary_set_row_marks(summaryview, row);
        debug_print(_("Message %d is locked\n"), msginfo->msgnum);
 }
@@ -2764,16 +2780,20 @@ static void summary_mark_row_as_read(SummaryView *summaryview,
        MsgInfo *msginfo;
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
-/* NOT NEEDED ANYMORE
        if (MSG_IS_NEW(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->newmsgs--;
        if (MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
                summaryview->unread--;
-*/
-       procmsg_msginfo_unset_flags(msginfo, MSG_NEW | MSG_UNREAD, 0);
-       summary_set_row_marks(summaryview, row);
-       debug_print(_("Message %d is marked as read\n"),
-               msginfo->msgnum);
+       if (MSG_IS_NEW(msginfo->flags) ||
+           MSG_IS_UNREAD(msginfo->flags)) {
+               MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
+               if (MSG_IS_IMAP(msginfo->flags))
+                       imap_msg_unset_perm_flags(msginfo, MSG_NEW | MSG_UNREAD);
+               CHANGE_FLAGS(msginfo);
+               summary_set_row_marks(summaryview, row);
+               debug_print(_("Message %d is marked as read\n"),
+                           msginfo->msgnum);
+       }
 }
 
 void summary_mark_as_read(SummaryView *summaryview)
@@ -2817,18 +2837,22 @@ static void summary_mark_row_as_unread(SummaryView *summaryview,
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
        if (MSG_IS_DELETED(msginfo->flags)) {
                msginfo->to_folder = NULL;
-               procmsg_msginfo_unset_flags(msginfo, MSG_DELETED, 0);
+               MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
                summaryview->deleted--;
        }
-/* NOT NEEDED ANYMORE
-       if (!MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_IGNORE_THREAD(msginfo->flags))
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_REPLIED | MSG_FORWARDED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_unset_perm_flags(msginfo, MSG_REPLIED);
+       if (!MSG_IS_UNREAD(msginfo->flags)) {
+               MSG_SET_PERM_FLAGS(msginfo->flags, MSG_UNREAD);
+               if (MSG_IS_IMAP(msginfo->flags))
+                       imap_msg_set_perm_flags(msginfo, MSG_UNREAD);
                summaryview->unread++;
-*/
+               debug_print(_("Message %d is marked as unread\n"),
+                           msginfo->msgnum);
+       }
 
-       procmsg_msginfo_unset_flags(msginfo, MSG_REPLIED | MSG_FORWARDED, 0);
-       procmsg_msginfo_set_flags(msginfo, MSG_UNREAD, 0);
-       debug_print(_("Message %d is marked as unread\n"),
-               msginfo->msgnum);
+       CHANGE_FLAGS(msginfo);
 
        summary_set_row_marks(summaryview, row);
 }
@@ -2923,8 +2947,12 @@ static void summary_delete_row(SummaryView *summaryview, GtkCTreeNode *row)
                        folderview_update_item(msginfo->to_folder, 0);
        }
        msginfo->to_folder = NULL;
-       procmsg_msginfo_unset_flags(msginfo, MSG_MARKED, MSG_MOVE | MSG_COPY);
-       procmsg_msginfo_set_flags(msginfo, MSG_DELETED, 0);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
+       MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
+       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_DELETED);
+       CHANGE_FLAGS(msginfo);
        summaryview->deleted++;
 
        if (!prefs_common.immediate_exec && 
@@ -3050,7 +3078,11 @@ static void summary_unmark_row(SummaryView *summaryview, GtkCTreeNode *row)
                        folderview_update_item(msginfo->to_folder, 0);
        }
        msginfo->to_folder = NULL;
-       procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_MOVE | MSG_COPY);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
+       MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE | MSG_COPY);
+       CHANGE_FLAGS(msginfo);
        summary_set_row_marks(summaryview, row);
        debug_print(_("Message %s/%d is unmarked\n"),
                    msginfo->folder->path, msginfo->msgnum);
@@ -3094,9 +3126,12 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCTreeNode *row,
                if (!prefs_common.immediate_exec)
                        msginfo->to_folder->op_count--;
        }
-       procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_COPY);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
+       MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_COPY);
        if (!MSG_IS_MOVE(msginfo->flags)) {
-               procmsg_msginfo_set_flags(msginfo, 0, MSG_MOVE);
+               MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MOVE);
                summaryview->moved++;
                changed = TRUE;
        }
@@ -3183,9 +3218,12 @@ static void summary_copy_row_to(SummaryView *summaryview, GtkCTreeNode *row,
                if (!prefs_common.immediate_exec)
                        msginfo->to_folder->op_count--;
        }
-       procmsg_msginfo_unset_flags(msginfo, MSG_MARKED | MSG_DELETED, MSG_MOVE);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED | MSG_DELETED);
+       if (MSG_IS_IMAP(msginfo->flags))
+               imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
+       MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MOVE);
        if (!MSG_IS_COPY(msginfo->flags)) {
-               procmsg_msginfo_set_flags(msginfo, 0, MSG_COPY);
+               MSG_SET_TMP_FLAGS(msginfo->flags, MSG_COPY);
                summaryview->copied++;
                changed = TRUE;
        }
@@ -3429,7 +3467,6 @@ static void summary_execute_move(SummaryView *summaryview)
                summaryview->mlist = NULL;
        }
 
-       folderview_update_item(summaryview->folder_item, FALSE);
        g_hash_table_destroy(summaryview->folder_table);
        summaryview->folder_table = NULL;
 }
@@ -3497,7 +3534,7 @@ static void summary_execute_copy_func(GtkCTree *ctree, GtkCTreeNode *node,
                summaryview->mlist =
                        g_slist_append(summaryview->mlist, msginfo);
 
-               procmsg_msginfo_unset_flags(msginfo, 0, MSG_COPY);
+               MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_COPY);
                summary_set_row_marks(summaryview, node);
        }
 }
@@ -3534,8 +3571,8 @@ static void summary_execute_delete(SummaryView *summaryview)
 
        if ((summaryview->folder_item != trash) && (trash != NULL)) {
                folder_item_scan(trash);
+               folderview_update_item(trash, FALSE);
        }
-       folderview_update_item(summaryview->folder_item, FALSE);
 }
 
 static void summary_execute_delete_func(GtkCTree *ctree, GtkCTreeNode *node,
@@ -4087,8 +4124,8 @@ void summary_set_colorlabel_color(GtkCTree *ctree, GtkCTreeNode *node,
        gint color_index;
 
        msginfo = gtk_ctree_node_get_row_data(ctree, node);
-       procmsg_msginfo_unset_flags(msginfo, MSG_CLABEL_FLAG_MASK, 0);
-       procmsg_msginfo_set_flags(msginfo, MSG_COLORLABEL_TO_FLAGS(labelcolor), 0);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_CLABEL_FLAG_MASK);
+       MSG_SET_COLORLABEL_VALUE(msginfo->flags, labelcolor);
 
        color_index = labelcolor == 0 ? -1 : (gint)labelcolor - 1;
        ctree_style = gtk_widget_get_style(GTK_WIDGET(ctree));
@@ -4563,7 +4600,10 @@ 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)) {
-                       procmsg_msginfo_unset_flags(msginfo, MSG_MARKED, 0);
+                       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_MARKED);
+                       if (MSG_IS_IMAP(msginfo->flags))
+                               imap_msg_unset_perm_flags(msginfo, MSG_MARKED);
+                       CHANGE_FLAGS(msginfo);
                        summary_set_row_marks(summaryview, row);
                } else
                        summary_mark_row(summaryview, row);
@@ -4580,7 +4620,8 @@ static void summary_selected(GtkCTree *ctree, GtkCTreeNode *row,
                break;
        case S_COL_LOCKED:
                if (MSG_IS_LOCKED(msginfo->flags)) {
-                       procmsg_msginfo_unset_flags(msginfo, MSG_LOCKED, 0);
+                       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_LOCKED);
+                       CHANGE_FLAGS(msginfo);
                        summary_set_row_marks(summaryview, row);
                }
                else
@@ -4968,13 +5009,13 @@ static void summary_ignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpoin
        MsgInfo *msginfo;
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
-/* NOT NEEDED ANYMORE
        if (MSG_IS_NEW(msginfo->flags))
                summaryview->newmsgs--;
        if (MSG_IS_UNREAD(msginfo->flags))
                summaryview->unread--;
-*/
-       procmsg_msginfo_set_flags(msginfo, MSG_IGNORE_THREAD, 0);
+       MSG_SET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
+
+       CHANGE_FLAGS(msginfo);
 
        summary_set_row_marks(summaryview, row);
        debug_print(_("Message %d is marked as ignore thread\n"),
@@ -5000,14 +5041,14 @@ static void summary_unignore_thread_func(GtkCTree *ctree, GtkCTreeNode *row, gpo
        MsgInfo *msginfo;
 
        msginfo = gtk_ctree_node_get_row_data(ctree, row);
-/* NOT NEEDED ANYMORE
        if (MSG_IS_NEW(msginfo->flags))
                summaryview->newmsgs++;
        if (MSG_IS_UNREAD(msginfo->flags))
                summaryview->unread++;
-*/
-       procmsg_msginfo_unset_flags(msginfo, MSG_IGNORE_THREAD, 0);
+       MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_IGNORE_THREAD);
 
+       CHANGE_FLAGS(msginfo);
+               
        summary_set_row_marks(summaryview, row);
        debug_print(_("Message %d is marked as unignore thread\n"),
            msginfo->msgnum);