[evolution-data-server/gnome-2-30] Extract EXPUNGE handling into imapx_expunge_uid_from_summary() function.



commit 176295453fca187e36538c7f77a5ca63d3109c05
Author: David Woodhouse <David Woodhouse intel com>
Date:   Sat Jun 19 11:57:03 2010 +0100

    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)

 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 ac787aa..68e8d84 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;



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