evolution-data-server r9391 - trunk/camel



Author: sragavan
Date: Tue Aug 19 05:29:34 2008
New Revision: 9391
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9391&view=rev

Log:
2008-08-19  Srinivasa Ragavan  <sragavan novell com>

	* camel/camel-folder-summary.c: Add functions to delete from summary
	fast, without dealing with db, so that bulk db can be invoked.
	* camel/camel-folder-summary.h:


Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-folder-summary.c
   trunk/camel/camel-folder-summary.h

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Tue Aug 19 05:29:34 2008
@@ -2160,6 +2160,36 @@
 		}
 }
 
+/* _fast doesn't deal with db and leaves it to the caller. */
+void
+camel_folder_summary_remove_uid_fast (CamelFolderSummary *s, const char *uid)
+{
+		CamelMessageInfo *oldinfo;
+		char *olduid;
+
+		CAMEL_SUMMARY_LOCK(s, summary_lock);
+		CAMEL_SUMMARY_LOCK(s, ref_lock);
+		if (g_hash_table_lookup_extended(s->loaded_infos, uid, (void *)&olduid, (void *)&oldinfo)) {
+				/* make sure it doesn't vanish while we're removing it */
+				oldinfo->refcount++;
+				CAMEL_SUMMARY_UNLOCK(s, ref_lock);
+				g_hash_table_remove (s->loaded_infos, olduid);	
+				summary_remove_uid (s, olduid);
+				s->flags |= CAMEL_SUMMARY_DIRTY;
+				s->meta_summary->msg_expunged = TRUE;
+				camel_message_info_free(oldinfo);
+				camel_message_info_free(oldinfo);
+				CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+		} else {
+				char *tmpid = g_strdup (uid);
+				/* Info isn't loaded into the memory. We must just remove the UID*/
+				summary_remove_uid (s, uid);
+				CAMEL_SUMMARY_UNLOCK(s, ref_lock);
+				CAMEL_SUMMARY_UNLOCK(s, summary_lock);
+				g_free (tmpid);
+		}
+}
+
 void
 camel_folder_summary_remove_index_fast (CamelFolderSummary *s, int index)
 {

Modified: trunk/camel/camel-folder-summary.h
==============================================================================
--- trunk/camel/camel-folder-summary.h	(original)
+++ trunk/camel/camel-folder-summary.h	Tue Aug 19 05:29:34 2008
@@ -358,6 +358,7 @@
 void camel_folder_summary_insert (CamelFolderSummary *s, CamelMessageInfo *info, gboolean load);
 
 void camel_folder_summary_remove_index_fast (CamelFolderSummary *s, int index);
+void camel_folder_summary_remove_uid_fast (CamelFolderSummary *s, const char *uid);
 
 /* build/add raw summary items */
 CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *summary, struct _camel_header_raw *headers);



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