[Commits] [SCM] claws branch, master, updated. 3.13.2-139-ga451a77

ticho at claws-mail.org ticho at claws-mail.org
Wed May 18 17:20:32 CEST 2016


The branch, master has been updated
       via  a451a77a45d751008a663d3b5f08381a38654917 (commit)
      from  c7e1e0bbdf72269708a53075a4accecb61ebebe2 (commit)

Summary of changes:
 src/folder.c        |   14 +++----
 src/imap.c          |   13 +++----
 src/prefs_account.c |   17 --------
 src/prefs_account.h |    1 -
 src/summaryview.c   |  107 ++++++++++++++++++---------------------------------
 5 files changed, 48 insertions(+), 104 deletions(-)


- Log -----------------------------------------------------------------
commit a451a77a45d751008a663d3b5f08381a38654917
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu May 12 10:03:39 2016 +0200

    Remove imap_use_trash account preference.
    
    Disabling this preference made deleting messages behave
    incorrectly - they were marked for deletion regardless
    of whether "delete" or "move to trash" was used, and
    these actions were not executed immediately, regardless
    of "immediate_execution" common preference.

diff --git a/src/folder.c b/src/folder.c
index 2b4dbe0..c229284 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -3543,9 +3543,7 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
 					item->folder->klass->remove_msg(item->folder,
 					    		        msginfo->folder,
 						    		msginfo->msgnum);
-				if (!item->folder->account || item->folder->account->imap_use_trash) {
-					remove_msginfo_from_cache(item, msginfo);
-				}
+				remove_msginfo_from_cache(item, msginfo);
 			}
 		}
 	}
@@ -3737,12 +3735,10 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
 	}
 	ret = folder->klass->remove_msg(folder, item, num);
 
-	if (!item->folder->account || item->folder->account->imap_use_trash) {
-		if (msginfo != NULL) {
-			if (ret == 0)
-				remove_msginfo_from_cache(item, msginfo);
-			procmsg_msginfo_free(&msginfo);
-		}
+	if (msginfo != NULL) {
+		if (ret == 0)
+			remove_msginfo_from_cache(item, msginfo);
+		procmsg_msginfo_free(&msginfo);
 	}
 
 	return ret;
diff --git a/src/imap.c b/src/imap.c
index a38c8d0..4bc5af1 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -400,7 +400,7 @@ static gint imap_cmd_store	(IMAPSession	*session,
 				 IMAPFlags flags,
 				 GSList *tags,
 				 int do_add);
-static gint imap_cmd_expunge	(IMAPSession	*session, gboolean force);
+static gint imap_cmd_expunge	(IMAPSession	*session);
 
 static void imap_path_separator_subst		(gchar		*str,
 						 gchar		 separator);
@@ -2554,7 +2554,7 @@ static gint imap_do_remove_msgs(Folder *folder, FolderItem *dest,
 			return ok;
 		}
 	} /* else we just need to expunge */
-	ok = imap_cmd_expunge(session, folder->account->imap_use_trash);
+	ok = imap_cmd_expunge(session);
 	if (ok != MAILIMAP_NO_ERROR) {
 		log_warning(LOG_PROTOCOL, _("can't expunge\n"));
 		g_free(destdir);
@@ -4435,13 +4435,10 @@ static gint imap_cmd_store(IMAPSession *session,
 	return MAILIMAP_NO_ERROR;
 }
 
-static gint imap_cmd_expunge(IMAPSession *session, gboolean do_expunge)
+static gint imap_cmd_expunge(IMAPSession *session)
 {
 	int r;
 	
-	if (!do_expunge)
-		return MAILIMAP_NO_ERROR;
-
 	if (prefs_common.work_offline && 
 	    !inc_offline_should_override(FALSE,
 		_("Claws Mail needs network access in order "
@@ -4464,7 +4461,7 @@ gint imap_expunge(Folder *folder, FolderItem *item)
 	if (session == NULL)
 		return -1;
 	
-	return imap_cmd_expunge(session, TRUE);
+	return imap_cmd_expunge(session);
 }
 
 static void imap_path_separator_subst(gchar *str, gchar separator)
@@ -5060,7 +5057,7 @@ static gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid)
 		return ok;
 	}
 
-	ok = imap_cmd_expunge(session, folder->account->imap_use_trash);
+	ok = imap_cmd_expunge(session);
 
 	if (ok != MAILIMAP_NO_ERROR) {
 		log_warning(LOG_PROTOCOL, _("can't expunge\n"));
diff --git a/src/prefs_account.c b/src/prefs_account.c
index 31c0d6f..5a4deec 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -309,7 +309,6 @@ typedef struct AdvancedPage
 	GtkWidget *draft_folder_entry;
 	GtkWidget *trash_folder_checkbtn;
 	GtkWidget *trash_folder_entry;
-	GtkWidget *imap_use_trash_checkbtn;
 } AdvancedPage;
 
 static BasicPage basic_page;
@@ -880,10 +879,6 @@ static PrefParam advanced_param[] = {
 	 &advanced_page.trash_folder_entry,
 	 prefs_set_data_from_entry, prefs_set_entry},
 	 
-	 {"imap_use_trash", "TRUE", &tmp_ac_prefs.imap_use_trash, P_BOOL,
-	 &advanced_page.imap_use_trash_checkbtn,
-	 prefs_set_data_from_toggle, prefs_set_toggle},
-
 
 	{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
@@ -2692,7 +2687,6 @@ static void advanced_create_widget_func(PrefsPage * _page,
 	GtkWidget *draft_folder_entry;
 	GtkWidget *trash_folder_checkbtn;
 	GtkWidget *trash_folder_entry;
-	GtkWidget *imap_use_trash_checkbtn;
 	GtkSizeGroup *size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 
 #define PACK_HBOX(hbox) \
@@ -2768,11 +2762,6 @@ static void advanced_create_widget_func(PrefsPage * _page,
 	gtk_box_pack_start (GTK_BOX (hbox1), entry_tunnelcmd, TRUE, TRUE, 0);
 	SET_TOGGLE_SENSITIVITY (checkbtn_tunnelcmd, entry_tunnelcmd);
 #endif
-	PACK_HBOX (hbox1);
-	PACK_CHECK_BUTTON (hbox1, imap_use_trash_checkbtn,
-			   _("Move deleted mails to trash and expunge immediately"));
-	CLAWS_SET_TIP(imap_use_trash_checkbtn,
-			     _("Moves deleted mails to trash instead of using the \\Deleted flag without expunging."));
 
 #if !GTK_CHECK_VERSION(3, 0, 0)
 	PACK_CHECK_BUTTON (hbox1, checkbtn_crosspost, 
@@ -2871,7 +2860,6 @@ static void advanced_create_widget_func(PrefsPage * _page,
 	page->draft_folder_entry  = draft_folder_entry;
 	page->trash_folder_checkbtn = trash_folder_checkbtn;
 	page->trash_folder_entry  = trash_folder_entry;
-	page->imap_use_trash_checkbtn = imap_use_trash_checkbtn;
 
 	tmp_ac_prefs = *ac_prefs;
 
@@ -4415,7 +4403,6 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
 		gtk_widget_hide(advanced_page.tunnelcmd_checkbtn);
 		gtk_widget_hide(advanced_page.tunnelcmd_entry);
 #endif
-		gtk_widget_hide(advanced_page.imap_use_trash_checkbtn);
 		gtk_widget_hide(receive_page.imapdir_label);
 		gtk_widget_hide(receive_page.imapdir_entry);
 		gtk_widget_hide(receive_page.subsonly_checkbtn);
@@ -4513,7 +4500,6 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
 		gtk_widget_hide(advanced_page.tunnelcmd_checkbtn);
 		gtk_widget_hide(advanced_page.tunnelcmd_entry);
 #endif
-		gtk_widget_hide(advanced_page.imap_use_trash_checkbtn);
 		gtk_widget_hide(receive_page.imapdir_label);
 		gtk_widget_hide(receive_page.imapdir_entry);
 		gtk_widget_hide(receive_page.subsonly_checkbtn);
@@ -4620,7 +4606,6 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
 		gtk_widget_show(advanced_page.tunnelcmd_checkbtn);
 		gtk_widget_show(advanced_page.tunnelcmd_entry);
 #endif
-		gtk_widget_show(advanced_page.imap_use_trash_checkbtn);
 		gtk_widget_show(receive_page.imapdir_label);
 		gtk_widget_show(receive_page.imapdir_entry);
 		gtk_widget_show(receive_page.subsonly_checkbtn);
@@ -4716,7 +4701,6 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
 		gtk_widget_hide(advanced_page.tunnelcmd_checkbtn);
 		gtk_widget_hide(advanced_page.tunnelcmd_entry);
 #endif
-		gtk_widget_hide(advanced_page.imap_use_trash_checkbtn);
 		gtk_widget_hide(receive_page.imapdir_label);
 		gtk_widget_hide(receive_page.imapdir_entry);
 		gtk_widget_hide(receive_page.subsonly_checkbtn);
@@ -4819,7 +4803,6 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
 		gtk_widget_hide(advanced_page.tunnelcmd_checkbtn);
 		gtk_widget_hide(advanced_page.tunnelcmd_entry);
 #endif
-		gtk_widget_hide(advanced_page.imap_use_trash_checkbtn);
 		gtk_widget_hide(receive_page.imapdir_label);
 		gtk_widget_hide(receive_page.imapdir_entry);
 		gtk_widget_hide(receive_page.subsonly_checkbtn);
diff --git a/src/prefs_account.h b/src/prefs_account.h
index dd118c4..b34c425 100644
--- a/src/prefs_account.h
+++ b/src/prefs_account.h
@@ -191,7 +191,6 @@ struct _PrefsAccount
 	gchar *imap_dir;
 	gboolean imap_subsonly;
 	gboolean low_bandwidth;
-	gboolean imap_use_trash;
 
 	gboolean set_sent_folder;
 	gchar *sent_folder;
diff --git a/src/summaryview.c b/src/summaryview.c
index 62e8e91..731d24f 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -4342,8 +4342,6 @@ static void summary_delete_row(SummaryView *summaryview, GtkCMCTreeNode *row)
 	if (!prefs_common.immediate_exec && 
 	    !folder_has_parent_of_type(summaryview->folder_item, F_TRASH)) {
 		summary_set_row_marks(summaryview, row);
-	} else if (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash) {
-		summary_set_row_marks(summaryview, row);
 	}
 	debug_print("Message %s/%d is set to delete\n",
 		    msginfo->folder->path, msginfo->msgnum);
@@ -4395,22 +4393,20 @@ void summary_delete(SummaryView *summaryview)
 	
 	START_LONG_OPERATION(summaryview, FALSE);
 
-	if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
-		if (!prefs_common.live_dangerously) {
-			gchar *buf = NULL;
-			int num = g_list_length(GTK_CMCLIST(summaryview->ctree)->selection);
-			buf = g_strdup_printf(ngettext(
-				"Do you really want to delete the selected message?",
-				"Do you really want to delete the %d selected messages?", num), 
-				num);
-			aval = alertpanel(ngettext("Delete message", "Delete messages", num),
-					  buf,
-					  GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL);
-			g_free(buf);
-			if (aval != G_ALERTALTERNATE) {
-				END_LONG_OPERATION(summaryview);
-				return;
-			}
+	if (!prefs_common.live_dangerously) {
+		gchar *buf = NULL;
+		int num = g_list_length(GTK_CMCLIST(summaryview->ctree)->selection);
+		buf = g_strdup_printf(ngettext(
+			"Do you really want to delete the selected message?",
+			"Do you really want to delete the %d selected messages?", num),
+			num);
+		aval = alertpanel(ngettext("Delete message", "Delete messages", num),
+				  buf,
+				  GTK_STOCK_CANCEL, "+"GTK_STOCK_DELETE, NULL);
+		g_free(buf);
+		if (aval != G_ALERTALTERNATE) {
+			END_LONG_OPERATION(summaryview);
+			return;
 		}
 	}
 
@@ -4472,8 +4468,7 @@ void summary_delete_trash(SummaryView *summaryview)
 		to_folder = summaryview->folder_item->folder->trash;
 	
 	if (to_folder == NULL || to_folder == summaryview->folder_item
-	    || folder_has_parent_of_type(summaryview->folder_item, F_TRASH)
-	    || (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash))
+	    || folder_has_parent_of_type(summaryview->folder_item, F_TRASH))
 		summary_delete(summaryview);
 	else
 		summary_move_selected_to(summaryview, to_folder);
@@ -4550,8 +4545,6 @@ static void summary_move_row_to(SummaryView *summaryview, GtkCMCTreeNode *row,
 	
 	if (!prefs_common.immediate_exec) {
 		summary_set_row_marks(summaryview, row);
-	} else if (msginfo->folder->folder->account && !msginfo->folder->folder->account->imap_use_trash) {
-		summary_set_row_marks(summaryview, row);
 	}
 
 	debug_print("Message %d is set to move to %s\n",
@@ -5124,23 +5117,6 @@ gboolean summary_expunge(SummaryView *summaryview)
 	return TRUE;
 }
 
-static void summary_set_deleted_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
-				      gpointer data)
-{
-	SummaryView *summaryview = data;
-	MsgInfo *msginfo;
-
-	msginfo = GTKUT_CTREE_NODE_GET_ROW_DATA(node);
-
-	if (msginfo && MSG_IS_MOVE(msginfo->flags)) {
-		msginfo->flags.tmp_flags &= ~ MSG_MOVE;
-		msginfo->flags.perm_flags |= MSG_DELETED;
-		summary_set_row_marks(summaryview, node);
-		summaryview->moved--;
-		summaryview->deleted++;
-	}
-}
-
 static gint summary_execute_move(SummaryView *summaryview)
 {
 	GtkCMCTree *ctree = GTK_CMCTREE(summaryview->ctree);
@@ -5159,14 +5135,10 @@ static gint summary_execute_move(SummaryView *summaryview)
 		hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, 
 			summary_update_msg, (gpointer) summaryview);
 
-		if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
-			for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
-				procmsg_msginfo_free((MsgInfo **)&(cur->data));
-		} 
-		if (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash) {
-			gtk_cmctree_pre_recursive(ctree, NULL, summary_set_deleted_func,
-					summaryview);
+		for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next) {
+			procmsg_msginfo_free((MsgInfo **)&(cur->data));
 		}
+
 		g_slist_free(summaryview->mlist);
 		summaryview->mlist = NULL;
 		return val;
@@ -5185,22 +5157,19 @@ static void summary_execute_move_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
 	if (msginfo && MSG_IS_MOVE(msginfo->flags) && msginfo->to_folder) {
 		summaryview->mlist =
 			g_slist_prepend(summaryview->mlist, msginfo);
-		if (!summaryview->folder_item->folder->account || 
-		     summaryview->folder_item->folder->account->imap_use_trash) {
-			gtk_cmctree_node_set_row_data(ctree, node, NULL);
-
-			if (msginfo->msgid && *msginfo->msgid &&
-			    node == g_hash_table_lookup(summaryview->msgid_table,
-							msginfo->msgid))
-				g_hash_table_remove(summaryview->msgid_table,
-						    msginfo->msgid);
-			if (prefs_common.thread_by_subject &&
-			    msginfo->subject && *msginfo->subject && 
-			    node == subject_table_lookup(summaryview->subject_table,
-							 msginfo->subject)) {
-				subject_table_remove(summaryview->subject_table,
-						     msginfo->subject);
-			}
+		gtk_cmctree_node_set_row_data(ctree, node, NULL);
+
+		if (msginfo->msgid && *msginfo->msgid &&
+		    node == g_hash_table_lookup(summaryview->msgid_table,
+						msginfo->msgid))
+			g_hash_table_remove(summaryview->msgid_table,
+					    msginfo->msgid);
+		if (prefs_common.thread_by_subject &&
+		    msginfo->subject && *msginfo->subject &&
+		    node == subject_table_lookup(summaryview->subject_table,
+						 msginfo->subject)) {
+			subject_table_remove(summaryview->subject_table,
+					     msginfo->subject);
 		}
 	}
 }
@@ -5223,7 +5192,7 @@ static void summary_execute_copy(SummaryView *summaryview)
 		summaryview->mlist = NULL;
 	}
 	summaryview->msginfo_update_callback_id =
-		hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, 
+		hooks_register_hook(MSGINFO_UPDATE_HOOKLIST,
 			summary_update_msg, (gpointer) summaryview);
 }
 
@@ -5250,10 +5219,9 @@ static void summary_execute_delete(SummaryView *summaryview)
 	GSList *cur;
 
 	/* search deleting messages and execute */
-	if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
-		gtk_cmctree_pre_recursive
-			(ctree, NULL, summary_execute_delete_func, summaryview);
-	}
+	gtk_cmctree_pre_recursive
+		(ctree, NULL, summary_execute_delete_func, summaryview);
+
 	if (!summaryview->mlist) return;
 
 	hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST,
@@ -5265,10 +5233,11 @@ static void summary_execute_delete(SummaryView *summaryview)
 	summaryview->msginfo_update_callback_id =
 		hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, 
 			summary_update_msg, (gpointer) summaryview);
-	if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
-		for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
+
+	for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next) {
 			procmsg_msginfo_free((MsgInfo **)&(cur->data));
 	}
+
 	g_slist_free(summaryview->mlist);
 	summaryview->mlist = NULL;
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list