evolution-data-server r8987 - branches/camel-db-summary/camel/providers/nntp



Author: psankar
Date: Mon Jun 16 15:46:05 2008
New Revision: 8987
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8987&view=rev

Log:
They call it NNTP On-Disk-Summaries



Modified:
   branches/camel-db-summary/camel/providers/nntp/camel-nntp-folder.c
   branches/camel-db-summary/camel/providers/nntp/camel-nntp-summary.c

Modified: branches/camel-db-summary/camel/providers/nntp/camel-nntp-folder.c
==============================================================================
--- branches/camel-db-summary/camel/providers/nntp/camel-nntp-folder.c	(original)
+++ branches/camel-db-summary/camel/providers/nntp/camel-nntp-folder.c	Mon Jun 16 15:46:05 2008
@@ -105,7 +105,7 @@
 nntp_folder_sync_online (CamelFolder *folder, CamelException *ex)
 {
 	CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
-	camel_folder_summary_save (folder->summary);
+	camel_folder_summary_save_to_db (folder->summary, ex);
 	CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
 }
 
@@ -113,7 +113,7 @@
 nntp_folder_sync_offline (CamelFolder *folder, CamelException *ex)
 {
 	CAMEL_SERVICE_REC_LOCK(folder->parent_store, connect_lock);
-	camel_folder_summary_save (folder->summary);
+	camel_folder_summary_save_to_db (folder->summary, ex);
 	CAMEL_SERVICE_REC_UNLOCK(folder->parent_store, connect_lock);
 }
 
@@ -419,8 +419,11 @@
 nntp_folder_finalise (CamelNNTPFolder *nntp_folder)
 {
 	struct _CamelNNTPFolderPrivate *p;
+	CamelException ex;
+
+	camel_exception_init (&ex);
 	
-	camel_folder_summary_save (((CamelFolder*) nntp_folder)->summary);
+	camel_folder_summary_save_to_db (((CamelFolder*) nntp_folder)->summary, &ex);
 	
 	p = nntp_folder->priv;
 	g_mutex_free (p->search_lock);
@@ -512,7 +515,7 @@
 	root = g_strdup_printf("%s.ev-summary", nntp_folder->storage_path);
 	folder->summary = (CamelFolderSummary *) camel_nntp_summary_new (folder, root);
 	g_free(root);
-	camel_folder_summary_load (folder->summary);
+	camel_folder_summary_load_from_db (folder->summary, ex);
 	
 	si = camel_store_summary_path ((CamelStoreSummary *) ((CamelNNTPStore*) parent)->summary, folder_name);
 	if (si) {

Modified: branches/camel-db-summary/camel/providers/nntp/camel-nntp-summary.c
==============================================================================
--- branches/camel-db-summary/camel/providers/nntp/camel-nntp-summary.c	(original)
+++ branches/camel-db-summary/camel/providers/nntp/camel-nntp-summary.c	Mon Jun 16 15:46:05 2008
@@ -427,28 +427,24 @@
 	if (cns->low != f) {
 		count = camel_folder_summary_count(s);
 		for (i = 0; i < count; i++) {
-			CamelMessageInfo *mi = camel_folder_summary_index(s, i);
+			const char *uid;
+			const char *msgid;
 
-			if (mi) {
-				const char *uid = camel_message_info_uid(mi);
-				const char *msgid;
+			uid  = camel_folder_summary_uid_from_index(s, i);
+			n = strtoul(uid, NULL, 10);
 
-				n = strtoul(uid, NULL, 10);
-				if (n < f || n > l) {
-					dd(printf("nntp_summary: %u is lower/higher than lowest/highest article, removed\n", n));
-					/* Since we use a global cache this could prematurely remove
-					   a cached message that might be in another folder - not that important as
-					   it is a true cache */
-					msgid = strchr(uid, ',');
-					if (msgid)
-						camel_data_cache_remove(store->cache, "cache", msgid+1, NULL);
-					camel_folder_change_info_remove_uid(changes, uid);
-					camel_folder_summary_remove(s, mi);
-					count--;
-					i--;
-				}
-				
-				camel_message_info_free(mi);
+			if (n < f || n > l) {
+				dd(printf("nntp_summary: %u is lower/higher than lowest/highest article, removed\n", n));
+				/* Since we use a global cache this could prematurely remove
+				   a cached message that might be in another folder - not that important as
+				   it is a true cache */
+				msgid = strchr(uid, ',');
+				if (msgid)
+					camel_data_cache_remove(store->cache, "cache", msgid+1, NULL);
+				camel_folder_change_info_remove_uid(changes, uid);
+				camel_folder_summary_remove_uid (s, uid);
+				count--;
+				i--;
 			}
 		}
 		cns->low = f;
@@ -467,7 +463,7 @@
 
 	/* TODO: not from here */
 	camel_folder_summary_touch(s);
-	camel_folder_summary_save(s);
+	camel_folder_summary_save_to_db (s, ex);
 update:
 	/* update store summary if we have it */
 	if (folder



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