[evolution-data-server] ECalBackendSync: Ensure no Recurrence-ID set when removing all components
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] ECalBackendSync: Ensure no Recurrence-ID set when removing all components
- Date: Mon, 12 Apr 2021 10:08:49 +0000 (UTC)
commit b019a1786a8e8e7fa906c443444ff27453bce270
Author: Milan Crha <mcrha redhat com>
Date: Mon Apr 12 12:05:03 2021 +0200
ECalBackendSync: Ensure no Recurrence-ID set when removing all components
When removing all components, the notification about the removal should
not have set the recurrence ID, thus the listeners know every instance of
a recurring component is removed.
src/calendar/libedata-cal/e-cal-backend-sync.c | 29 +++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/src/calendar/libedata-cal/e-cal-backend-sync.c b/src/calendar/libedata-cal/e-cal-backend-sync.c
index ec9b49f88..f1eaac85b 100644
--- a/src/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/src/calendar/libedata-cal/e-cal-backend-sync.c
@@ -796,13 +796,40 @@ cal_backend_remove_objects (ECalBackend *backend,
{
GError *error = NULL;
GSList *old_components = NULL, *new_components = NULL;
+ GSList *tmp_ids = NULL;
e_cal_backend_sync_remove_objects (E_CAL_BACKEND_SYNC (backend), cal, cancellable, ids, mod, opflags,
&old_components, &new_components, &error);
- e_data_cal_respond_remove_objects (cal, opid, error, ids, old_components, new_components);
+ /* Ensure there is no recurrence-id on the IDs when removing all components. */
+ if (!error && mod == E_CAL_OBJ_MOD_ALL) {
+ GSList *link;
+
+ for (link = (GSList *) ids; link; link = g_slist_next (link)) {
+ ECalComponentId *id = link->data;
+
+ if (id && e_cal_component_id_get_rid (id))
+ break;
+ }
+
+ if (link) {
+ for (link = (GSList *) ids; link; link = g_slist_next (link)) {
+ ECalComponentId *id = e_cal_component_id_copy (link->data);
+
+ if (id)
+ e_cal_component_id_set_rid (id, NULL);
+
+ tmp_ids = g_slist_prepend (tmp_ids, id);
+ }
+
+ tmp_ids = g_slist_reverse (tmp_ids);
+ }
+ }
+
+ e_data_cal_respond_remove_objects (cal, opid, error, tmp_ids ? tmp_ids : ids, old_components,
new_components);
e_util_free_nullable_object_slist (old_components);
e_util_free_nullable_object_slist (new_components);
+ g_slist_free_full (tmp_ids, e_cal_component_id_free);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]