+2008-06-25 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #476640
+
+ * backends/file/e-cal-backend-file.c: (cancel_received_object):
+ Pass back old and new object after the remove.
+ * backends/file/e-cal-backend-file.c:
+ (e_cal_backend_file_receive_objects): Cancel event properly.
+
2008-06-22 Patrick Ohly <patrick.ohly@gmx.de>
* libecal/e-cal-check-timezones.c,
}
static gboolean
-cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp)
+cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp, char **old_object, char **new_object)
{
ECalBackendFileObject *obj_data;
ECalBackendFilePrivate *priv;
priv = cbfile->priv;
+ *old_object = NULL;
+ *new_object = NULL;
+
/* Find the old version of the component. */
obj_data = g_hash_table_lookup (priv->comp_uid_hash, icalcomponent_get_uid (icalcomp));
if (!obj_data)
return FALSE;
}
+ *old_object = e_cal_component_get_as_string (obj_data->full_object);
+
+ /* new_object is kept NULL if not removing the instance */
rid = e_cal_component_get_recurid_as_string (comp);
- if (rid && *rid)
+ if (rid && *rid) {
remove_instance (cbfile, obj_data, rid);
- else
+ *new_object = e_cal_component_get_as_string (obj_data->full_object);
+ } else
remove_component (cbfile, icalcomponent_get_uid (icalcomp), obj_data);
g_free (rid);
/* Now we manipulate the components we care about */
for (l = comps; l; l = l->next) {
const char *uid;
- char *object, *old_object, *rid;
+ char *object, *old_object, *rid, *new_object;
ECalBackendFileObject *obj_data;
subcomp = l->data;
goto error;
break;
case ICAL_METHOD_CANCEL:
- if (cancel_received_object (cbfile, subcomp)) {
+ old_object = NULL;
+ new_object = NULL;
+ if (cancel_received_object (cbfile, subcomp, &old_object, &new_object)) {
ECalComponentId *id;
- object = icalcomponent_as_ical_string (subcomp);
- obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
- if (obj_data)
- old_object = e_cal_component_get_as_string (obj_data->full_object);
- else
- old_object = NULL;
id = e_cal_component_get_id (comp);
- e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, object);
+ e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, new_object);
/* remove the component from the toplevel VCALENDAR */
icalcomponent_remove_component (toplevel_comp, subcomp);
icalcomponent_free (subcomp);
e_cal_component_free_id (id);
+ g_free (new_object);
g_free (old_object);
- g_free (object);
}
g_free (rid);
break;