[evolution-data-server/gnome-3-26] Bug 788051 - Junk messages moved to a real folder are considered seen
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-26] Bug 788051 - Junk messages moved to a real folder are considered seen
- Date: Mon, 25 Sep 2017 15:28:32 +0000 (UTC)
commit 55dd328d3f9dba5cf31e4f7fd479543eecbda515
Author: Milan Crha <mcrha redhat com>
Date: Mon Sep 25 17:26:09 2017 +0200
Bug 788051 - Junk messages moved to a real folder are considered seen
src/camel/camel-folder-summary.c | 18 ++++++++++++++++++
src/camel/camel-message-info.c | 23 ++++++++++++++++++++++-
2 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/camel-folder-summary.c b/src/camel/camel-folder-summary.c
index 3194538..f265011 100644
--- a/src/camel/camel-folder-summary.c
+++ b/src/camel/camel-folder-summary.c
@@ -375,6 +375,13 @@ folder_summary_update_counts_by_flags (CamelFolderSummary *summary,
is_junk_folder = vtrash && camel_vtrash_folder_get_folder_type (vtrash) ==
CAMEL_VTRASH_FOLDER_JUNK;
is_trash_folder = vtrash && camel_vtrash_folder_get_folder_type (vtrash) ==
CAMEL_VTRASH_FOLDER_TRASH;
+ } else if (summary->priv->folder) {
+ guint32 folder_flags;
+
+ folder_flags = camel_folder_get_flags (summary->priv->folder);
+
+ is_junk_folder = (folder_flags & CAMEL_FOLDER_IS_JUNK) != 0;
+ is_trash_folder = (folder_flags & CAMEL_FOLDER_IS_TRASH) != 0;
}
if (!(flags & CAMEL_MESSAGE_SEEN))
@@ -421,6 +428,10 @@ folder_summary_update_counts_by_flags (CamelFolderSummary *summary,
if (unread) {
summary->priv->unread_count += unread;
+
+ if (summary->priv->unread_count < 0)
+ summary->priv->unread_count = 0;
+
g_object_notify (summary_object, "unread-count");
changed = TRUE;
}
@@ -574,6 +585,13 @@ camel_folder_summary_replace_flags (CamelFolderSummary *summary,
is_junk_folder = vtrash && camel_vtrash_folder_get_folder_type (vtrash) ==
CAMEL_VTRASH_FOLDER_JUNK;
is_trash_folder = vtrash && camel_vtrash_folder_get_folder_type (vtrash) ==
CAMEL_VTRASH_FOLDER_TRASH;
+ } else if (summary->priv->folder) {
+ guint32 folder_flags;
+
+ folder_flags = camel_folder_get_flags (summary->priv->folder);
+
+ is_junk_folder = (folder_flags & CAMEL_FOLDER_IS_JUNK) != 0;
+ is_trash_folder = (folder_flags & CAMEL_FOLDER_IS_TRASH) != 0;
}
added_flags = new_flags & (~(old_flags & new_flags));
diff --git a/src/camel/camel-message-info.c b/src/camel/camel-message-info.c
index 35cd1ac..b2c5f08 100644
--- a/src/camel/camel-message-info.c
+++ b/src/camel/camel-message-info.c
@@ -261,6 +261,7 @@ message_info_save (const CamelMessageInfo *mi,
const CamelNamedFlags *user_flags;
const CamelNameValueArray *user_tags;
const GArray *references;
+ guint32 read_or_flags = CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_JUNK;
g_return_val_if_fail (CAMEL_IS_MESSAGE_INFO (mi), FALSE);
g_return_val_if_fail (record != NULL, FALSE);
@@ -269,7 +270,27 @@ message_info_save (const CamelMessageInfo *mi,
record->uid = (gchar *) camel_pstring_strdup (camel_message_info_get_uid (mi));
record->flags = camel_message_info_get_flags (mi);
- record->read = ((record->flags & (CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_JUNK)))
? 1 : 0;
+ if ((record->flags & CAMEL_MESSAGE_JUNK) != 0) {
+ CamelFolderSummary *folder_summary;
+
+ folder_summary = camel_message_info_ref_summary (mi);
+ if (folder_summary) {
+ CamelFolder *folder;
+
+ folder = camel_folder_summary_get_folder (folder_summary);
+ if (folder) {
+ guint32 folder_flags = camel_folder_get_flags (folder);
+
+ /* Do not consider Junk flag as message being read when it's a Junk folder */
+ if ((folder_flags & CAMEL_FOLDER_IS_JUNK) != 0)
+ read_or_flags = read_or_flags & (~CAMEL_MESSAGE_JUNK);
+ }
+
+ g_object_unref (folder_summary);
+ }
+ }
+
+ record->read = ((record->flags & (CAMEL_MESSAGE_SEEN | read_or_flags))) ? 1 : 0;
record->deleted = (record->flags & CAMEL_MESSAGE_DELETED) != 0 ? 1 : 0;
record->replied = (record->flags & CAMEL_MESSAGE_ANSWERED) != 0 ? 1 : 0;
record->important = (record->flags & CAMEL_MESSAGE_FLAGGED) != 0 ? 1 : 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]