[evolution-ews/gnome-3-6] Bug #671893 - Filter by 'Mailing list' doesn't work



commit c52e77e9314e2a3420b6daa4f351c416b9bc4e6d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 28 17:39:42 2012 +0100

    Bug #671893 - Filter by 'Mailing list' doesn't work

 src/camel/camel-ews-folder.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index d1b4781..3f1fa96 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -571,6 +571,38 @@ exit:
 	return message;
 }
 
+static void
+ews_folder_maybe_update_mlist (CamelFolder *folder,
+			       const gchar *uid,
+			       CamelMimeMessage *message)
+{
+	CamelEwsMessageInfo *mi;
+
+	g_return_if_fail (CAMEL_IS_FOLDER (folder));
+	g_return_if_fail (uid != NULL);
+	g_return_if_fail (message != NULL);
+
+	mi = (CamelEwsMessageInfo *) camel_folder_summary_get (folder->summary, uid);
+	if (!mi)
+		return;
+
+	if (!mi->info.mlist || !*mi->info.mlist) {
+		/* update mailing list information, if necessary */
+		gchar *mlist = camel_header_raw_check_mailing_list (&(CAMEL_MIME_PART (message)->headers));
+
+		if (mlist) {
+			if (mi->info.mlist)
+				camel_pstring_free (mi->info.mlist);
+			mi->info.mlist = camel_pstring_add (mlist, TRUE);
+			mi->info.dirty = TRUE;
+
+			camel_folder_summary_touch (folder->summary);
+		}
+	}
+
+	camel_message_info_free ((CamelMessageInfo *) mi);
+}
+
 /* Get the message from cache if available otherwise get it from server */
 static CamelMimeMessage *
 ews_folder_get_message_sync (CamelFolder *folder,
@@ -581,8 +613,10 @@ ews_folder_get_message_sync (CamelFolder *folder,
 	CamelMimeMessage *message;
 
 	message = camel_ews_folder_get_message_from_cache ((CamelEwsFolder *) folder, uid, cancellable, NULL);
-	if (!message)
+	if (!message) {
 		message = camel_ews_folder_get_message (folder, uid, EWS_ITEM_HIGH, cancellable, error);
+		ews_folder_maybe_update_mlist (folder, uid, message);
+	}
 
 	return message;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]