aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-04-07 16:47:04 +0800
committerMilan Crha <mcrha@redhat.com>2010-04-07 16:47:04 +0800
commit6bf10247c0ad49e1b666783993f8aae835ad26d2 (patch)
tree4b5ee1feb13713fda8a825d7c426f5f2117fbf6e /mail
parent09390f2a916e7b89aa8af579002471ffa48021b5 (diff)
downloadgsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.tar
gsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.tar.gz
gsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.tar.bz2
gsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.tar.lz
gsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.tar.xz
gsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.tar.zst
gsoc2013-evolution-6bf10247c0ad49e1b666783993f8aae835ad26d2.zip
Do not hide junk mail when vJunk folder not supported by store
This is part of bug #257641, to not hide junk emails in folders where their store doesn't support vJunk folder. In that case the junk mail should be either placed in a real junk folder or not having the flag set. But because there can be mails with the junk flag set, and they would be otherwise hidden for a user, then this allows to show them.
Diffstat (limited to 'mail')
-rw-r--r--mail/message-list.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 2c1422bff8..e1c841106e 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -251,9 +251,6 @@ static const gchar *followup_icons[] = {
"stock_mail-flag-for-followup-done"
};
-/* FIXME: junk prefs */
-static gboolean junk_folder = TRUE;
-
#ifdef SMART_ADDRESS_COMPARE
static EMailAddress *
e_mail_address_new (const gchar *address)
@@ -2825,6 +2822,20 @@ clear_tree (MessageList *ml, gboolean tfree)
}
+static gboolean
+folder_store_supports_vjunk_folder (CamelFolder *folder)
+{
+ CamelStore *store;
+
+ g_return_val_if_fail (folder != NULL, FALSE);
+
+ store = camel_folder_get_parent_store (folder);
+ if (!store)
+ return FALSE;
+
+ return (store->flags & CAMEL_STORE_VJUNK) != 0;
+}
+
/* Check if the given node is selectable in the current message list,
* which depends on the type of the folder (normal, junk, trash). */
static gboolean
@@ -2835,18 +2846,21 @@ is_node_selectable (MessageList *ml, CamelMessageInfo *info)
guint32 flags;
gboolean flag_junk;
gboolean flag_deleted;
+ gboolean store_has_vjunk;
g_return_val_if_fail (ml != NULL, FALSE);
g_return_val_if_fail (ml->folder != NULL, FALSE);
g_return_val_if_fail (info != NULL, FALSE);
+ store_has_vjunk = folder_store_supports_vjunk_folder (ml->folder);
+
/* check folder type */
- is_junk_folder = ml->folder->folder_flags & CAMEL_FOLDER_IS_JUNK;
+ is_junk_folder = store_has_vjunk && (ml->folder->folder_flags & CAMEL_FOLDER_IS_JUNK) != 0;
is_trash_folder = ml->folder->folder_flags & CAMEL_FOLDER_IS_TRASH;
/* check flags set on current message */
flags = camel_message_info_flags (info);
- flag_junk = flags & CAMEL_MESSAGE_JUNK;
+ flag_junk = store_has_vjunk && (flags & CAMEL_MESSAGE_JUNK) != 0;
flag_deleted = flags & CAMEL_MESSAGE_DELETED;
/* perform actions depending on folder type */
@@ -3624,7 +3638,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const g
gconf = mail_config_get_gconf_client ();
hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
message_list->hidedeleted = hide_deleted && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
- message_list->hidejunk = junk_folder && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
+ message_list->hidejunk = folder_store_supports_vjunk_folder (message_list->folder) && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH);
if (message_list->frozen == 0)
mail_regen_list (message_list, message_list->search, NULL, NULL);
@@ -4226,6 +4240,8 @@ regen_list_exec (struct _regen_list_msg *m)
if (expr == NULL) {
uids = camel_folder_get_uids (m->folder);
} else {
+ gboolean store_has_vjunk = folder_store_supports_vjunk_folder (m->folder);
+
searchuids = uids = camel_folder_search_by_expression (m->folder, expr, &m->base.ex);
/* If m->changes is not NULL, then it means we are called from folder_changed event,
thus we will keep the selected message to be sure it doesn't disappear because
@@ -4247,7 +4263,7 @@ regen_list_exec (struct _regen_list_msg *m)
if (looking_info) {
gboolean is_deleted = (camel_message_info_flags (looking_info) & CAMEL_MESSAGE_DELETED) != 0;
- gboolean is_junk = (camel_message_info_flags (looking_info) & CAMEL_MESSAGE_JUNK) != 0;
+ gboolean is_junk = store_has_vjunk && (camel_message_info_flags (looking_info) & CAMEL_MESSAGE_JUNK) != 0;
/* I would really like to check for CAMEL_MESSAGE_FOLDER_FLAGGED on a message,
so I would know whether it was changed locally, and then just check the changes