[evolution-mapi] Bug #607632 - Marking a message unread doesn't reflect on a server
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Bug #607632 - Marking a message unread doesn't reflect on a server
- Date: Fri, 14 May 2010 11:46:34 +0000 (UTC)
commit 737db71498b4a23501510b939e6477935b356b33
Author: Johnny Jacob <jjohnny gnome org>
Date: Fri May 14 13:45:59 2010 +0200
Bug #607632 - Marking a message unread doesn't reflect on a server
src/camel/camel-mapi-folder.c | 29 +++++++++++++++++++++++++++++
src/camel/camel-mapi-summary.c | 12 ++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 351137a..800a280 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -396,6 +396,7 @@ mapi_update_cache (CamelFolder *folder, GSList *list, CamelFolderChangeInfo **ch
}
mi->info.flags = item->header.flags;
+ mi->server_flags = mi->info.flags;
if (!exists) {
GSList *l = NULL;
@@ -821,6 +822,8 @@ mapi_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
to_free = g_slist_prepend (to_free, mid);
else
g_free (mid);
+
+ mapi_info->server_flags = mapi_info->info.flags;
}
camel_message_info_free (info);
}
@@ -840,6 +843,13 @@ mapi_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
g_slist_free (read_items);
}
+ if (unread_items) {
+ camel_service_lock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+ exchange_mapi_connection_set_flags (camel_mapi_store_get_exchange_connection (mapi_store), 0, fid, unread_items, CLEAR_READ_FLAG, options);
+ camel_service_unlock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+ g_slist_free (read_items);
+ }
+
/* Remove messages from server*/
if (deleted_items) {
camel_service_lock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
@@ -1534,6 +1544,24 @@ mapi_append_message (CamelFolder *folder, CamelMimeMessage *message,
return !camel_exception_is_set (ex);
}
+static gboolean
+mapi_set_message_flags (CamelFolder *folder, const gchar *uid, guint32 flags, guint32 set)
+{
+ CamelMessageInfo *info;
+ gint res;
+
+ g_return_val_if_fail (folder->summary != NULL, FALSE);
+
+ info = camel_folder_summary_uid (folder->summary, uid);
+ if (info == NULL)
+ return FALSE;
+
+ res = camel_message_info_set_flags (info, flags, set);
+
+ camel_message_info_free (info);
+ return res;
+}
+
static void
mapi_folder_dispose (GObject *object)
{
@@ -1590,6 +1618,7 @@ camel_mapi_folder_class_init (CamelMapiFolderClass *class)
folder_class->append_message = mapi_append_message;
folder_class->refresh_info = mapi_refresh_info;
folder_class->sync = mapi_sync;
+ folder_class->set_message_flags = mapi_set_message_flags;
folder_class->expunge = mapi_expunge;
folder_class->transfer_messages_to = mapi_transfer_messages_to;
}
diff --git a/src/camel/camel-mapi-summary.c b/src/camel/camel-mapi-summary.c
index feb4985..9823a5d 100644
--- a/src/camel/camel-mapi-summary.c
+++ b/src/camel/camel-mapi-summary.c
@@ -203,6 +203,15 @@ mapi_message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
camel_mapi_summary_parent_class);
info = folder_summary_class->message_info_from_db (s, mir);
+ if (info) {
+ gchar *part = mir->bdata;
+ if (part && *part) {
+ CamelMapiMessageInfo *m_info;
+
+ m_info = (CamelMapiMessageInfo *) info;
+ MS_EXTRACT_FIRST_DIGIT (m_info->server_flags);
+ }
+ }
return info;
}
@@ -211,12 +220,15 @@ static CamelMIRecord *
mapi_message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info)
{
CamelFolderSummaryClass *folder_summary_class;
+ CamelMapiMessageInfo *m_info = (CamelMapiMessageInfo *) info;
struct _CamelMIRecord *mir;
folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (
camel_mapi_summary_parent_class);
mir = folder_summary_class->message_info_to_db (s, info);
+ if (mir)
+ mir->bdata = g_strdup_printf ("%u", m_info->server_flags);
return mir;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]