evolution-data-server r9092 - in branches/camel-db-summary: . camel camel/providers/imap libedataserver po



Author: sragavan
Date: Thu Jul  3 12:19:41 2008
New Revision: 9092
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9092&view=rev

Log:
Merge branch 'master' into disk-summary


Modified:
   branches/camel-db-summary/ChangeLog
   branches/camel-db-summary/camel/ChangeLog
   branches/camel-db-summary/camel/camel-folder.c
   branches/camel-db-summary/camel/camel-folder.h
   branches/camel-db-summary/camel/providers/imap/ChangeLog
   branches/camel-db-summary/camel/providers/imap/camel-imap-folder.c
   branches/camel-db-summary/camel/providers/imap/camel-imap-store.c
   branches/camel-db-summary/libedataserver/e-source-group.c
   branches/camel-db-summary/po/ChangeLog
   branches/camel-db-summary/po/oc.po

Modified: branches/camel-db-summary/camel/camel-folder.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder.c	(original)
+++ branches/camel-db-summary/camel/camel-folder.c	Thu Jul  3 12:19:41 2008
@@ -89,6 +89,8 @@
 static GPtrArray        *get_uids            (CamelFolder *folder);
 static void              free_uids           (CamelFolder *folder,
 					      GPtrArray *array);
+static void              sort_uids           (CamelFolder *folder,
+					      GPtrArray *uids);
 static GPtrArray        *get_summary         (CamelFolder *folder);
 static void              free_summary        (CamelFolder *folder,
 					      GPtrArray *array);
@@ -144,6 +146,7 @@
 	camel_folder_class->get_message = get_message;
 	camel_folder_class->get_uids = get_uids;
 	camel_folder_class->free_uids = free_uids;
+	camel_folder_class->sort_uids = sort_uids;
 	camel_folder_class->get_summary = get_summary;
 	camel_folder_class->free_summary = free_summary;
 	camel_folder_class->search_by_expression = search_by_expression;
@@ -1214,6 +1217,46 @@
 	CF_CLASS (folder)->free_uids (folder, array);
 }
 
+
+static int
+uidcmp (const void *v0, const void *v1)
+{
+	const char *str0 = *(const char **) v0;
+	const char *str1 = *(const char **) v1;
+	guint32 uid0 = strtoul (str0, NULL, 10);
+	guint32 uid1 = strtoul (str1, NULL, 10);
+	
+	if (uid0 < uid1)
+		return -1;
+	else if (uid0 == uid1)
+		return 0;
+	else
+		return 1;
+}
+
+static void
+sort_uids (CamelFolder *folder, GPtrArray *uids)
+{
+	qsort (uids->pdata, uids->len, sizeof (void *), uidcmp);
+}
+
+
+/**
+ * camel_folder_sort_uids:
+ * @folder: a #CamelFolder object
+ * @uids: array of uids
+ *
+ * Sorts the array of UIDs.
+ **/
+void
+camel_folder_sort_uids (CamelFolder *folder, GPtrArray *uids)
+{
+	g_return_if_fail (CAMEL_IS_FOLDER (folder));
+	
+	CF_CLASS (folder)->sort_uids (folder, uids);
+}
+
+
 static GPtrArray *
 get_summary(CamelFolder *folder)
 {

Modified: branches/camel-db-summary/camel/camel-folder.h
==============================================================================
--- branches/camel-db-summary/camel/camel-folder.h	(original)
+++ branches/camel-db-summary/camel/camel-folder.h	Thu Jul  3 12:19:41 2008
@@ -175,7 +175,9 @@
 	GPtrArray * (*get_uids)       (CamelFolder *folder);
 	void (*free_uids)             (CamelFolder *folder,
 				       GPtrArray *array);
-
+	
+	void (* sort_uids) (CamelFolder *folder, GPtrArray *uids);
+	
 	GPtrArray * (*get_summary)    (CamelFolder *folder);
 	void (*free_summary)          (CamelFolder *folder,
 				       GPtrArray *summary);
@@ -204,7 +206,7 @@
 	void     (*freeze)    (CamelFolder *folder);
 	void     (*thaw)      (CamelFolder *folder);
 	gboolean (*is_frozen) (CamelFolder *folder);
-
+	
 	CamelFolderQuotaInfo * (*get_quota_info) (CamelFolder *folder);
 } CamelFolderClass;
 
@@ -304,6 +306,8 @@
 GPtrArray *        camel_folder_get_uids              (CamelFolder *folder);
 void               camel_folder_free_uids             (CamelFolder *folder,
 						       GPtrArray *array);
+void               camel_folder_sort_uids             (CamelFolder *folder,
+						       GPtrArray *uids);
 
 /* search api */
 gboolean           camel_folder_has_search_capability (CamelFolder *folder);

Modified: branches/camel-db-summary/camel/providers/imap/camel-imap-folder.c
==============================================================================
--- branches/camel-db-summary/camel/providers/imap/camel-imap-folder.c	(original)
+++ branches/camel-db-summary/camel/providers/imap/camel-imap-folder.c	Thu Jul  3 12:19:41 2008
@@ -1328,6 +1328,7 @@
 	CamelImapResponse *response;
 	int uid = 0;
 	char *set;
+	gboolean full_expunge = (store->capabilities & IMAP_CAPABILITY_UIDPLUS) == 0;
 	
 	CAMEL_SERVICE_REC_LOCK (store, connect_lock);
 
@@ -1354,10 +1355,24 @@
 			return;
 		}
 
-		if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
+		if (!full_expunge) {
 			response = camel_imap_command (store, folder, ex,
 						       "UID EXPUNGE %s", set);
-		} else
+
+			if (camel_exception_is_set (ex)) {
+				g_debug (G_STRLOC ": 'UID EXPUNGE %s' failed: %s (0x%x)", set, camel_exception_get_description (ex), camel_exception_get_id (ex));
+				camel_exception_clear (ex);
+
+				/* UID EXPUNGE failed, something is broken on the server probably,
+				   thus fall back to the full expunge. It's not so good, especially
+				   when resyncing, it will remove already marked messages on the
+				   server too. I guess that's fine anyway, isn't it?
+				   For failed command see Gnome's bug #536486 */
+				full_expunge = TRUE;
+			}
+		}
+
+		if (full_expunge)
 			response = camel_imap_command (store, folder, ex, "EXPUNGE");
 
 		if (response)

Modified: branches/camel-db-summary/camel/providers/imap/camel-imap-store.c
==============================================================================
--- branches/camel-db-summary/camel/providers/imap/camel-imap-store.c	(original)
+++ branches/camel-db-summary/camel/providers/imap/camel-imap-store.c	Thu Jul  3 12:19:41 2008
@@ -2598,9 +2598,25 @@
 				if (((fi->flags ^ si->flags) & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)) {
 					si->flags = (si->flags & ~CAMEL_FOLDER_SUBSCRIBED) | (fi->flags & CAMEL_FOLDER_SUBSCRIBED);
 					camel_store_summary_touch((CamelStoreSummary *)imap_store->summary);
+
+					camel_object_trigger_event (CAMEL_OBJECT (imap_store), "folder_created", fi);
+					camel_object_trigger_event (CAMEL_OBJECT (imap_store), "folder_subscribed", fi);
 				}
 			} else {
-				camel_store_summary_remove((CamelStoreSummary *)imap_store->summary, si);
+				char *dup_folder_name = g_strdup (camel_store_info_path (imap_store->summary, si));
+
+				if (dup_folder_name) {
+					CamelException eex;
+
+					camel_exception_init (&eex);
+					imap_folder_effectively_unsubscribed (imap_store, dup_folder_name, &eex);
+					imap_forget_folder (imap_store, dup_folder_name, &eex);
+
+					g_free (dup_folder_name);
+					camel_exception_clear (&eex);
+				} else
+					camel_store_summary_remove ((CamelStoreSummary *)imap_store->summary, si);
+
 				count--;
 				i--;
 			}

Modified: branches/camel-db-summary/libedataserver/e-source-group.c
==============================================================================
--- branches/camel-db-summary/libedataserver/e-source-group.c	(original)
+++ branches/camel-db-summary/libedataserver/e-source-group.c	Thu Jul  3 12:19:41 2008
@@ -316,6 +316,7 @@
 			goto done;
 		}
 		e_source_group_add_source (new, new_source, -1);
+		g_object_unref (new_source);
 	}
 
 	e_source_group_set_readonly (new, readonly_str && !strcmp (GC readonly_str, "yes"));
@@ -713,6 +714,7 @@
 							      group);
 			g_signal_emit (group, signals[SOURCE_REMOVED], 0, source);
 			g_signal_emit (group, signals[CHANGED], 0);
+			g_object_unref (source);
 			return TRUE;
 		}
 	}
@@ -742,6 +744,7 @@
 							      group);
 			g_signal_emit (group, signals[SOURCE_REMOVED], 0, source);
 			g_signal_emit (group, signals[CHANGED], 0);
+			g_object_unref (source);
 			return TRUE;
 		}
 	}



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