diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-06-19 11:57:03 +0100 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-06-28 13:29:35 +0100 |
commit | 176295453fca187e36538c7f77a5ca63d3109c05 (patch) | |
tree | 4e975bc3da3ef0e433348995c8f370b1e3dd2580 | |
parent | 0895dac4c2c9bd800abb28984fe2ee50428773fa (diff) | |
download | evolution-data-server-176295453fca187e36538c7f77a5ca63d3109c05.tar.gz |
Extract EXPUNGE handling into imapx_expunge_uid_from_summary() function.
We'll want to use the same function for handling VANISHED.
(cherry picked from commit 4a50a5ee9abdff7cf32bab0841568f71cc86c926)
-rw-r--r-- | camel/providers/imapx/camel-imapx-server.c | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c index ac787aaa7..68e8d84b0 100644 --- a/camel/providers/imapx/camel-imapx-server.c +++ b/camel/providers/imapx/camel-imapx-server.c @@ -1085,6 +1085,36 @@ imapx_is_job_in_queue (CamelIMAPXServer *is, const gchar *folder_name, guint32 t return NULL; } +static void +imapx_expunge_uid_from_summary(CamelIMAPXServer *imap, gchar *uid) +{ + CamelMessageInfo *mi; + + if (imap->changes == NULL) + imap->changes = camel_folder_change_info_new(); + + mi = camel_folder_summary_uid (imap->select_folder->summary, uid); + if (mi) { + imapx_update_summary_for_removed_message (mi, imap->select_folder); + camel_message_info_free (mi); + } + + camel_folder_summary_remove_uid_fast (imap->select_folder->summary, uid); + imap->expunged = g_slist_prepend (imap->expunged, uid); + + camel_folder_change_info_remove_uid (imap->changes, uid); + + if (imapx_idle_supported (imap) && imapx_in_idle (imap)) { + camel_db_delete_uids (imap->store->cdb_w, imap->select_folder->full_name, imap->expunged, NULL); + imapx_update_store_summary (imap->select_folder); + camel_object_trigger_event(imap->select_folder, "folder_changed", imap->changes); + + g_slist_foreach (imap->expunged, (GFunc) g_free, NULL); + imap->expunged = NULL; + camel_folder_change_info_clear (imap->changes); + } +} + /* handle any untagged responses */ static gint imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) @@ -1134,35 +1164,12 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex) c(printf("expunged: %d\n", id)); if (imap->select_folder) { gchar *uid = NULL; - CamelMessageInfo *mi; uid = camel_folder_summary_uid_from_index (imap->select_folder->summary, expunge - 1); if (!uid) break; - if (imap->changes == NULL) - imap->changes = camel_folder_change_info_new(); - - mi = camel_folder_summary_uid (imap->select_folder->summary, uid); - if (mi) { - imapx_update_summary_for_removed_message (mi, imap->select_folder); - camel_message_info_free (mi); - } - - camel_folder_summary_remove_uid_fast (imap->select_folder->summary, uid); - imap->expunged = g_slist_prepend (imap->expunged, uid); - - camel_folder_change_info_remove_uid (imap->changes, uid); - - if (imapx_idle_supported (imap) && imapx_in_idle (imap)) { - camel_db_delete_uids (imap->store->cdb_w, imap->select_folder->full_name, imap->expunged, NULL); - imapx_update_store_summary (imap->select_folder); - camel_object_trigger_event(imap->select_folder, "folder_changed", imap->changes); - - g_slist_foreach (imap->expunged, (GFunc) g_free, NULL); - imap->expunged = NULL; - camel_folder_change_info_clear (imap->changes); - } + imapx_expunge_uid_from_summary(imap, uid); } break; |