[evolution-patches] patch from the recurrences-work branch



The attached patch is coming from the recurrences-work-branch, and makes
the file calendar backend deal correctly with any detached instance
there might be in the .ics file.

This is useful even if we don't support fully detached instances, since
users might get that sort of instances from meetings, from webcal
calendars, etc.

cheers
? libical/src/libicalss/icalssyacc.output
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.266
diff -u -p -r1.266 ChangeLog
--- ChangeLog	18 May 2004 03:29:25 -0000	1.266
+++ ChangeLog	18 May 2004 12:28:31 -0000
@@ -1,3 +1,8 @@
+2004-05-18  Rodrigo Moya <rodrigo ximian com>
+
+	* backends/file/e-cal-backend-file.c (add_component): make sure we
+	process correctly the detached instances.
+
 2004-05-17  Rodney Dawes  <dobey ximian com>
 
 	* libecal/Makefile.am (libecal_la_LIBADD):
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.30
diff -u -p -r1.30 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c	17 May 2004 15:01:17 -0000	1.30
+++ backends/file/e-cal-backend-file.c	18 May 2004 12:28:32 -0000
@@ -403,38 +403,46 @@ add_component (ECalBackendFile *cbfile, 
 
 	priv = cbfile->priv;
 
-	if (e_cal_component_is_instance (comp)) { /* FIXME: more checks needed, to detect detached instances */
+	e_cal_component_get_uid (comp, &uid);
+	obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
+	if (e_cal_component_is_instance (comp)) {
 		const char *rid;
-
-		e_cal_component_get_uid (comp, &uid);
-
-		obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
-		if (!obj_data) {
-			g_warning (G_STRLOC ": Got an instance of a non-existing component");
-			return;
-		}
-
+	
 		rid = e_cal_component_get_recurid_as_string (comp);
-		if (g_hash_table_lookup (obj_data->recurrences, rid)) {
-			g_warning (G_STRLOC ": Tried to adding an already existing recurrence");
-			return;
+		if (obj_data) {
+			if (g_hash_table_lookup (obj_data->recurrences, rid)) {
+				g_warning (G_STRLOC ": Tried to add an already existing recurrence");
+				return;
+			}
+		} else {
+			obj_data = g_new0 (ECalBackendFileObject, 1);
+			obj_data->full_object = NULL;
+			obj_data->recurrences = g_hash_table_new (g_str_hash, g_str_equal);
+			g_hash_table_insert (priv->comp_uid_hash, (gpointer) uid, obj_data);
 		}
 
 		g_hash_table_insert (obj_data->recurrences, g_strdup (rid), comp);
-		/* FIXME: sort the recurrences */
 		obj_data->recurrences_list = g_list_append (obj_data->recurrences_list, comp);
 	} else {
 		/* Ensure that the UID is unique; some broken implementations spit
 		 * components with duplicated UIDs.
 		 */
 		check_dup_uid (cbfile, comp);
-		e_cal_component_get_uid (comp, &uid);
 
-		obj_data = g_new0 (ECalBackendFileObject, 1);
-		obj_data->full_object = comp;
-		obj_data->recurrences = g_hash_table_new (g_str_hash, g_str_equal);
+		if (obj_data) {
+			if (obj_data->full_object) {
+				g_warning (G_STRLOC ": Tried to add an already existing object");
+				return;
+			}
+
+			obj_data->full_object = comp;
+		} else {
+			obj_data = g_new0 (ECalBackendFileObject, 1);
+			obj_data->full_object = comp;
+			obj_data->recurrences = g_hash_table_new (g_str_hash, g_str_equal);
 
-		g_hash_table_insert (priv->comp_uid_hash, (gpointer) uid, obj_data);
+			g_hash_table_insert (priv->comp_uid_hash, (gpointer) uid, obj_data);
+		}
 	}
 
 	priv->comp = g_list_prepend (priv->comp, comp);


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