[evolution-groupwise] Adapt to CamelFolderSummary API changes
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-groupwise] Adapt to CamelFolderSummary API changes
- Date: Thu, 6 Oct 2011 15:02:03 +0000 (UTC)
commit 80c3cf177c19c4a6e42c677e9f945aeabb839f0a
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 6 17:01:23 2011 +0200
Adapt to CamelFolderSummary API changes
src/camel/camel-groupwise-folder.c | 66 ++++++++++--------
src/camel/camel-groupwise-journal.c | 12 ++--
src/camel/camel-groupwise-store.c | 4 +-
src/camel/camel-groupwise-summary.c | 128 ++++++++++++++---------------------
4 files changed, 96 insertions(+), 114 deletions(-)
---
diff --git a/src/camel/camel-groupwise-folder.c b/src/camel/camel-groupwise-folder.c
index 07fd687..432eb7b 100644
--- a/src/camel/camel-groupwise-folder.c
+++ b/src/camel/camel-groupwise-folder.c
@@ -626,7 +626,7 @@ groupwise_sync_summary (CamelFolder *folder,
si = camel_store_summary_path ((CamelStoreSummary *) ((CamelGroupwiseStore *) parent_store)->summary, full_name);
total = camel_folder_summary_count (folder->summary);
- unread = folder->summary->unread_count;
+ unread = camel_folder_summary_get_unread_count (folder->summary);
if (si) {
si->unread = unread;
@@ -647,16 +647,15 @@ sync_flags (CamelFolder *folder,
CamelMessageInfo *info = NULL;
CamelGroupwiseMessageInfo *gw_info;
- for (l = uids; l != NULL; l = g_list_next (l))
- {
- info = camel_folder_summary_uid (folder->summary, l->data);
+ for (l = uids; l != NULL; l = g_list_next (l)) {
+ info = camel_folder_summary_get (folder->summary, l->data);
gw_info = (CamelGroupwiseMessageInfo *) info;
if (!info)
continue;
gw_info->info.flags &= ~CAMEL_MESSAGE_FOLDER_FLAGGED;
- gw_info->info.dirty = 1;
+ gw_info->info.dirty = TRUE;
gw_info->server_flags = gw_info->info.flags;
camel_folder_summary_touch (folder->summary);
@@ -676,7 +675,7 @@ groupwise_set_message_flags (CamelFolder *folder,
g_return_val_if_fail (folder->summary != NULL, FALSE);
- info = camel_folder_summary_uid (folder->summary, uid);
+ info = camel_folder_summary_get (folder->summary, uid);
if (info == NULL)
return FALSE;
@@ -713,9 +712,10 @@ groupwise_sync (CamelFolder *folder,
EGwConnectionStatus status;
EGwConnection *cnc;
const gchar *full_name;
- gint count, i;
+ gint i;
gboolean success;
GList *deleted_items, *deleted_head;
+ GPtrArray *known_uids;
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
@@ -743,17 +743,16 @@ groupwise_sync (CamelFolder *folder,
changes = camel_folder_change_info_new ();
camel_folder_summary_prepare_fetch_all (folder->summary, error);
- count = camel_folder_summary_count (folder->summary);
+ known_uids = camel_folder_summary_get_array (folder->summary);
CAMEL_GROUPWISE_FOLDER_REC_LOCK (folder, cache_lock);
- for (i = 0; i < count; i++) {
+ for (i = 0; known_uids && i < known_uids->len && (update_single == NULL || update_single != info); i++) {
guint32 flags = 0;
if (update_single != NULL) {
info = update_single;
camel_message_info_ref (info);
- count = 1;
} else
- info = camel_folder_summary_index (folder->summary, i);
+ info = camel_folder_summary_get (folder->summary, g_ptr_array_index (known_uids, i));
gw_info = (CamelGroupwiseMessageInfo *) info;
@@ -848,8 +847,6 @@ groupwise_sync (CamelFolder *folder,
camel_folder_change_info_remove_uid (changes, uid);
CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
deleted_items = g_list_next (deleted_items);
- count -= GROUPWISE_BULK_DELETE_LIMIT;
- i -= GROUPWISE_BULK_DELETE_LIMIT;
}
}
}
@@ -865,6 +862,7 @@ groupwise_sync (CamelFolder *folder,
}
CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
+ camel_folder_summary_free_array (known_uids);
/* Do things in bulk. Reduces server calls, network latency etc. */
if (deleted_read_items)
@@ -1016,6 +1014,10 @@ camel_gw_folder_new (CamelStore *store,
return NULL;
}
+ camel_store_summary_connect_folder_summary (
+ (CamelStoreSummary *) ((CamelGroupwiseStore *) store)->summary,
+ folder_name, folder->summary);
+
return folder;
}
@@ -1173,7 +1175,7 @@ check_for_new_mails_count (CamelGroupwiseSummary *gw_summary,
for (l = ids; l != NULL; l = g_slist_next (l)) {
EGwItem *item = l->data;
const gchar *id = e_gw_item_get_id (item);
- CamelMessageInfo *info = camel_folder_summary_uid (summary, id);
+ CamelMessageInfo *info = camel_folder_summary_get (summary, id);
if (!info)
count++;
@@ -1611,7 +1613,7 @@ gw_update_cache (CamelFolder *folder,
mi = NULL;
pmi = NULL;
- pmi = camel_folder_summary_uid (folder->summary, id);
+ pmi = camel_folder_summary_get (folder->summary, id);
if (pmi) {
exists = TRUE;
camel_message_info_ref (pmi);
@@ -1854,7 +1856,7 @@ gw_update_summary (CamelFolder *folder,
status_flags = 0;
id = e_gw_item_get_id (item);
- mi = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, id);
+ mi = (CamelGroupwiseMessageInfo *) camel_folder_summary_get (folder->summary, id);
if (mi)
exists = TRUE;
@@ -2403,6 +2405,7 @@ groupwise_cmp_uids (CamelFolder *folder,
static void
groupwise_folder_dispose (GObject *object)
{
+ CamelStore *parent_store;
CamelGroupwiseFolder *gw_folder = CAMEL_GROUPWISE_FOLDER (object);
if (gw_folder->cache != NULL) {
@@ -2415,6 +2418,13 @@ groupwise_folder_dispose (GObject *object)
gw_folder->search = NULL;
}
+ parent_store = camel_folder_get_parent_store (CAMEL_FOLDER (gw_folder));
+ if (parent_store) {
+ camel_store_summary_disconnect_folder_summary (
+ (CamelStoreSummary *) ((CamelGroupwiseStore *) parent_store)->summary,
+ CAMEL_FOLDER (gw_folder)->summary);
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (camel_groupwise_folder_parent_class)->dispose (object);
}
@@ -2553,10 +2563,11 @@ groupwise_expunge_sync (CamelFolder *folder,
EGwConnection *cnc;
EGwConnectionStatus status;
CamelFolderChangeInfo *changes;
- gint i, max;
+ gint i;
gboolean delete = FALSE;
GList *deleted_items, *deleted_head;
const gchar *full_name;
+ GPtrArray *known_uids;
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
@@ -2587,9 +2598,9 @@ groupwise_expunge_sync (CamelFolder *folder,
container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, full_name));
camel_folder_summary_prepare_fetch_all (folder->summary, error);
- max = camel_folder_summary_count (folder->summary);
- for (i = 0; i < max; i++) {
- info = camel_folder_summary_index (folder->summary, i);
+ known_uids = camel_folder_summary_get_array (folder->summary);
+ for (i = 0; known_uids && i < known_uids->len; i++) {
+ info = camel_folder_summary_get (folder->summary, g_ptr_array_index (known_uids, i));
ginfo = (CamelGroupwiseMessageInfo *) info;
if (ginfo && (ginfo->info.flags & CAMEL_MESSAGE_DELETED)) {
@@ -2615,8 +2626,6 @@ groupwise_expunge_sync (CamelFolder *folder,
camel_data_cache_remove(gw_folder->cache, "cache", uid, NULL);
CAMEL_GROUPWISE_FOLDER_REC_UNLOCK (folder, cache_lock);
deleted_items = g_list_next (deleted_items);
- max -= GROUPWISE_BULK_DELETE_LIMIT;
- i -= GROUPWISE_BULK_DELETE_LIMIT;
}
}
delete = TRUE;
@@ -2624,6 +2633,7 @@ groupwise_expunge_sync (CamelFolder *folder,
}
camel_message_info_free (info);
}
+ camel_folder_summary_free_array (known_uids);
if (deleted_items) {
/* FIXME: Put these in a function and reuse it inside the above loop, here and in groupwise_sync*/
@@ -2682,7 +2692,7 @@ groupwise_folder_get_message_sync (CamelFolder *folder,
/* see if it is there in cache */
- mi = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, uid);
+ mi = (CamelGroupwiseMessageInfo *) camel_folder_summary_get (folder->summary, uid);
if (mi == NULL) {
g_set_error (
error, CAMEL_FOLDER_ERROR,
@@ -2826,7 +2836,7 @@ groupwise_refresh_info_sync (CamelFolder *folder,
guint32 unread, total;
total = camel_folder_summary_count (folder->summary);
- unread = folder->summary->unread_count;
+ unread = camel_folder_summary_get_unread_count (folder->summary);
if (si->total != total || si->unread != unread) {
si->total = total;
@@ -2927,7 +2937,7 @@ groupwise_transfer_messages_to_sync (CamelFolder *source,
CamelMessageInfo *info;
gboolean success;
- if (!(info = camel_folder_summary_uid (source->summary, uids->pdata[i])))
+ if (!(info = camel_folder_summary_get (source->summary, uids->pdata[i])))
continue;
if (!(message = groupwise_folder_get_message_sync (source, camel_message_info_uid (info), cancellable, error)))
@@ -2964,7 +2974,7 @@ groupwise_transfer_messages_to_sync (CamelFolder *source,
CamelGroupwiseMessageInfo *gw_info = NULL;
flags_diff_t diff, unset_flags;
- info = camel_folder_summary_uid (source->summary, uids->pdata[index]);
+ info = camel_folder_summary_get (source->summary, uids->pdata[index]);
if (!info) {
g_warning ("Could not find the message: its either deleted or moved already");
index++;
@@ -3041,12 +3051,8 @@ groupwise_transfer_messages_to_sync (CamelFolder *source,
if (status == E_GW_CONNECTION_STATUS_OK) {
if (delete_originals) {
- if (!(gw_info->info.flags & CAMEL_MESSAGE_SEEN))
- source->summary->unread_count--;
-
camel_folder_summary_remove_uid (source->summary, uids->pdata[index]);
camel_folder_change_info_remove_uid (changes, uids->pdata[index]);
- /*}*/
}
} else {
g_warning ("Warning!! Could not move item : %s\n", (gchar *)uids->pdata[index]);
diff --git a/src/camel/camel-groupwise-journal.c b/src/camel/camel-groupwise-journal.c
index 7c89f25..6aed6fa 100644
--- a/src/camel/camel-groupwise-journal.c
+++ b/src/camel/camel-groupwise-journal.c
@@ -188,7 +188,7 @@ groupwise_entry_play_append (CamelOfflineJournal *journal,
g_object_unref (stream);
- if (!(info = camel_folder_summary_uid (folder->summary, entry->uid))) {
+ if (!(info = camel_folder_summary_get (folder->summary, entry->uid))) {
/* Note: this should never happen, but rather than crash lets make a new info */
info = camel_message_info_new (NULL);
}
@@ -223,7 +223,7 @@ groupwise_entry_play_transfer (CamelOfflineJournal *journal,
parent_store = camel_folder_get_parent_store (folder);
- if (!(info = (CamelMessageInfoBase *) camel_folder_summary_uid (folder->summary, entry->uid))) {
+ if (!(info = (CamelMessageInfoBase *) camel_folder_summary_get (folder->summary, entry->uid))) {
/* Note: this should never happen, but rather than crash lets make a new info */
info = camel_message_info_new (NULL);
}
@@ -235,7 +235,7 @@ groupwise_entry_play_transfer (CamelOfflineJournal *journal,
if (camel_folder_transfer_messages_to_sync (
src, uids, folder, FALSE, &xuids, cancellable, error)) {
- real = (CamelGroupwiseMessageInfo *) camel_folder_summary_uid (folder->summary, xuids->pdata[0]);
+ real = (CamelGroupwiseMessageInfo *) camel_folder_summary_get (folder->summary, xuids->pdata[0]);
/* transfer all the system flags, user flags/tags, etc */
gw_message_info_dup_to ((CamelMessageInfoBase *) real, (CamelMessageInfoBase *) info);
@@ -329,7 +329,8 @@ update_cache (CamelGroupwiseJournal *groupwise_journal,
uid = g_strdup_printf ("-%u", nextuid);
if (!(cache = camel_data_cache_add (groupwise_folder->cache, "cache", uid, error))) {
- folder->summary->nextuid--;
+ /* this will not change it anyway */
+ camel_folder_summary_set_next_uid (folder->summary, nextuid - 1);
g_free (uid);
return FALSE;
}
@@ -340,7 +341,8 @@ update_cache (CamelGroupwiseJournal *groupwise_journal,
g_prefix_error (
error, _("Cannot append message in offline mode: "));
camel_data_cache_remove (groupwise_folder->cache, "cache", uid, NULL);
- folder->summary->nextuid--;
+ /* this will not change it anyway */
+ camel_folder_summary_set_next_uid (folder->summary, nextuid - 1);
g_object_unref (cache);
g_free (uid);
return FALSE;
diff --git a/src/camel/camel-groupwise-store.c b/src/camel/camel-groupwise-store.c
index 412de33..cdc72a6 100644
--- a/src/camel/camel-groupwise-store.c
+++ b/src/camel/camel-groupwise-store.c
@@ -639,7 +639,7 @@ groupwise_store_get_folder_sync (CamelStore *store,
cancellable,
_("Fetching summary information for new messages in %s"),
camel_folder_get_display_name (folder));
- camel_folder_summary_clear (folder->summary);
+ camel_folder_summary_clear (folder->summary, NULL);
while (!done) {
status = e_gw_connection_read_cursor (priv->cnc, container_id,
@@ -744,7 +744,7 @@ gw_store_reload_folder (CamelGroupwiseStore *gw_store,
}
summary = (CamelGroupwiseSummary *) folder->summary;
- camel_folder_summary_clear (folder->summary);
+ camel_folder_summary_clear (folder->summary, NULL);
camel_folder_summary_save_to_db (folder->summary, NULL);
summary_count = camel_folder_summary_count (folder->summary);
diff --git a/src/camel/camel-groupwise-summary.c b/src/camel/camel-groupwise-summary.c
index 6c3a539..e63f53c 100644
--- a/src/camel/camel-groupwise-summary.c
+++ b/src/camel/camel-groupwise-summary.c
@@ -49,11 +49,11 @@ static CamelMessageInfo *gw_message_info_migrate (CamelFolderSummary *s, FILE *i
static CamelMessageContentInfo * gw_content_info_migrate (CamelFolderSummary *s, FILE *in);
static gboolean gw_info_set_flags (CamelMessageInfo *info, guint32 flags, guint32 set);
-static gint summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
+static gboolean summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir);
static CamelFIRecord * summary_header_to_db (CamelFolderSummary *s, GError **error);
static CamelMIRecord * message_info_to_db (CamelFolderSummary *s, CamelMessageInfo *info);
static CamelMessageInfo * message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
-static gint content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
+static gboolean content_info_to_db (CamelFolderSummary *s, CamelMessageContentInfo *info, CamelMIRecord *mir);
static CamelMessageContentInfo * content_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir);
/*End of Prototypes*/
@@ -101,10 +101,6 @@ camel_groupwise_summary_class_init (CamelGroupwiseSummaryClass *class)
static void
camel_groupwise_summary_init (CamelGroupwiseSummary *gw_summary)
{
- CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (gw_summary);
-
- /* Meta-summary - Overriding UID len */
- summary->meta_summary->uid_len = 2048;
}
/**
@@ -122,8 +118,7 @@ camel_groupwise_summary_new (struct _CamelFolder *folder,
{
CamelFolderSummary *summary;
- summary = g_object_new (CAMEL_TYPE_GROUPWISE_SUMMARY, NULL);
- summary->folder = folder;
+ summary = g_object_new (CAMEL_TYPE_GROUPWISE_SUMMARY, "folder", folder, NULL);
camel_folder_summary_set_build_content (summary, TRUE);
camel_folder_summary_set_filename (summary, filename);
@@ -132,15 +127,15 @@ camel_groupwise_summary_new (struct _CamelFolder *folder,
return summary;
}
-static gint
+static gboolean
summary_header_from_db (CamelFolderSummary *s,
CamelFIRecord *mir)
{
CamelGroupwiseSummary *gms = CAMEL_GROUPWISE_SUMMARY (s);
gchar *part;
- if (CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_from_db (s, mir) == -1)
- return -1;
+ if (!CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->summary_header_from_db (s, mir))
+ return FALSE;
part = mir->bdata;
@@ -151,7 +146,7 @@ summary_header_from_db (CamelFolderSummary *s,
gms->time_string = g_strdup (part);
}
- return 0;
+ return TRUE;
}
static gint
@@ -284,7 +279,7 @@ gw_content_info_migrate (CamelFolderSummary *s,
return camel_folder_summary_content_info_new (s);
}
-static gint
+static gboolean
content_info_to_db (CamelFolderSummary *s,
CamelMessageContentInfo *info,
CamelMIRecord *mir)
@@ -295,7 +290,7 @@ content_info_to_db (CamelFolderSummary *s,
return CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->content_info_to_db (s, info, mir);
} else {
mir->cinfo = g_strdup ("0");
- return 0;
+ return TRUE;
}
}
@@ -304,65 +299,48 @@ gw_info_set_flags (CamelMessageInfo *info,
guint32 flags,
guint32 set)
{
- guint32 old;
- CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
- gint read = 0 , deleted = 0;
-
- gint junk_flag = 0, junk_learn_flag = 0;
-
- /* TODO: locking? */
-
- if (flags & CAMEL_MESSAGE_SEEN && ((set & CAMEL_MESSAGE_SEEN) != (mi->flags & CAMEL_MESSAGE_SEEN)))
- { read = set & CAMEL_MESSAGE_SEEN ? 1 : -1; d(printf("Setting read as %d\n", set & CAMEL_MESSAGE_SEEN ? 1 : 0));}
+ guint32 old;
+ CamelMessageInfoBase *mi = (CamelMessageInfoBase *) info;
+ gboolean junk_flag = 0, junk_learn_flag = 0;
- if (flags & CAMEL_MESSAGE_DELETED && ((set & CAMEL_MESSAGE_DELETED) != (mi->flags & CAMEL_MESSAGE_DELETED)))
- { deleted = set & CAMEL_MESSAGE_DELETED ? 1 : -1; d(printf("Setting deleted as %d\n", set & CAMEL_MESSAGE_DELETED ? 1 : 0));}
- old = mi->flags;
- mi->flags = (old & ~flags) | (set & flags);
+ old = mi->flags;
+ mi->flags = (old & ~flags) | (set & flags);
- if (old != mi->flags) {
- mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
- mi->dirty = TRUE;
+ if (old != mi->flags) {
+ mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+ mi->dirty = TRUE;
- if (((old & ~CAMEL_MESSAGE_SYSTEM_MASK) == (mi->flags & ~CAMEL_MESSAGE_SYSTEM_MASK)) )
- return FALSE;
-
- if (mi->summary) {
- mi->summary->deleted_count += deleted;
- mi->summary->unread_count -= read;
- camel_folder_summary_touch (mi->summary);
- }
- }
-
- junk_flag = ((flags & CAMEL_MESSAGE_JUNK) && (set & CAMEL_MESSAGE_JUNK));
- junk_learn_flag = ((flags & CAMEL_MESSAGE_JUNK_LEARN) && (set & CAMEL_MESSAGE_JUNK_LEARN));
-
- /* This is a hack, we are using CAMEL_MESSAGE_JUNK justo to hide the item
- * we make sure this doesn't have any side effects*/
-
- if (junk_learn_flag && !junk_flag && (old & CAMEL_GW_MESSAGE_JUNK)) {
- /*
- * This has ugly side-effects. Evo will never learn unjunk.
- * We need to create one CAMEL_MESSAGE_HIDDEN flag which must be
- * used for all hiding operations. We must also get rid of the seperate file
- * that is maintained somewhere in evolution/mail/em-folder-browser.c for hidden messages
- */
- mi->flags |= CAMEL_GW_MESSAGE_NOJUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
- } else if (junk_learn_flag && junk_flag && !(old & CAMEL_GW_MESSAGE_JUNK)) {
- mi->flags |= CAMEL_GW_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
- }
+ if (((old & ~CAMEL_MESSAGE_SYSTEM_MASK) == (mi->flags & ~CAMEL_MESSAGE_SYSTEM_MASK)) )
+ return FALSE;
+ }
- if (mi->summary && mi->summary->folder && mi->uid) {
- CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
+ junk_flag = ((flags & CAMEL_MESSAGE_JUNK) && (set & CAMEL_MESSAGE_JUNK));
+ junk_learn_flag = ((flags & CAMEL_MESSAGE_JUNK_LEARN) && (set & CAMEL_MESSAGE_JUNK_LEARN));
+
+ /* This is a hack, we are using CAMEL_MESSAGE_JUNK justo to hide the item
+ * we make sure this doesn't have any side effects*/
+
+ if (junk_learn_flag && !junk_flag && (old & CAMEL_GW_MESSAGE_JUNK)) {
+ /*
+ * This has ugly side-effects. Evo will never learn unjunk.
+ * We need to create one CAMEL_MESSAGE_HIDDEN flag which must be
+ * used for all hiding operations. We must also get rid of the seperate file
+ * that is maintained somewhere in evolution/mail/em-folder-browser.c for hidden messages
+ */
+ mi->flags |= CAMEL_GW_MESSAGE_NOJUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ flags |= CAMEL_GW_MESSAGE_NOJUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ set |= CAMEL_GW_MESSAGE_NOJUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ } else if (junk_learn_flag && junk_flag && !(old & CAMEL_GW_MESSAGE_JUNK)) {
+ mi->flags |= CAMEL_GW_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ flags |= CAMEL_GW_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ set |= CAMEL_GW_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK | CAMEL_MESSAGE_JUNK_LEARN;
+ }
- camel_folder_change_info_change_uid (changes, camel_message_info_uid (info));
- camel_folder_changed (mi->summary->folder, changes);
- camel_folder_change_info_free (changes);
- camel_folder_summary_touch (mi->summary);
- }
+ if (mi->summary)
+ return CAMEL_FOLDER_SUMMARY_CLASS (camel_groupwise_summary_parent_class)->info_set_flags (info, flags, set);
- return TRUE;
+ return TRUE;
}
void
@@ -416,27 +394,23 @@ groupwise_summary_clear (CamelFolderSummary *summary,
gboolean uncache)
{
CamelFolderChangeInfo *changes;
- CamelMessageInfo *info;
- gint i, count;
+ gint i;
const gchar *uid;
+ GPtrArray *known_uids;
changes = camel_folder_change_info_new ();
- count = camel_folder_summary_count (summary);
- for (i = 0; i < count; i++) {
- if (!(info = camel_folder_summary_index (summary, i)))
- continue;
-
- uid = camel_message_info_uid (info);
+ known_uids = camel_folder_summary_get_array (summary);
+ for (i = 0; known_uids && i < known_uids->len; i++) {
+ uid = g_ptr_array_index (known_uids, i);
camel_folder_change_info_remove_uid (changes, uid);
camel_folder_summary_remove_uid (summary, uid);
- camel_message_info_free (info);
}
- camel_folder_summary_clear_db (summary);
+ camel_folder_summary_clear (summary, NULL);
/*camel_folder_summary_save (summary);*/
if (camel_folder_change_info_changed (changes))
- camel_folder_changed (summary->folder, changes);
+ camel_folder_changed (camel_folder_summary_get_folder (summary), changes);
camel_folder_change_info_free (changes);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]