Blame SOURCES/evolution-ews-3.28.5-meeting-with-attachment.patch

d8acc1
diff -up evolution-ews-3.28.5/src/calendar/e-cal-backend-ews.c.meeting-with-attachment evolution-ews-3.28.5/src/calendar/e-cal-backend-ews.c
d8acc1
--- evolution-ews-3.28.5/src/calendar/e-cal-backend-ews.c.meeting-with-attachment	2018-09-27 18:32:25.783038625 +0200
d8acc1
+++ evolution-ews-3.28.5/src/calendar/e-cal-backend-ews.c	2018-09-27 18:32:25.786038625 +0200
d8acc1
@@ -2598,7 +2598,7 @@ ecb_ews_save_component_sync (ECalMetaBac
d8acc1
 		GHashTable *removed_indexes;
d8acc1
 		EwsCalendarConvertData convert_data = { 0 };
d8acc1
 		EEwsItem *item = NULL;
d8acc1
-		const EwsId *ews_id = NULL;
d8acc1
+		EwsId *ews_id = NULL;
d8acc1
 		const gchar *send_meeting_invitations;
d8acc1
 		icalcomponent *icalcomp;
d8acc1
 		icalproperty *prop;
d8acc1
@@ -2642,7 +2642,7 @@ ecb_ews_save_component_sync (ECalMetaBac
d8acc1
 			if (item) {
d8acc1
 				g_object_ref (item);
d8acc1
 
d8acc1
-				ews_id = e_ews_item_get_id (item);
d8acc1
+				ews_id = e_ews_id_copy (e_ews_item_get_id (item));
d8acc1
 			}
d8acc1
 		}
d8acc1
 
d8acc1
@@ -2666,6 +2666,8 @@ ecb_ews_save_component_sync (ECalMetaBac
d8acc1
 				g_clear_object (&item);
d8acc1
 
d8acc1
 				item = items_req->data;
d8acc1
+
d8acc1
+				e_ews_id_free (ews_id);
d8acc1
 				ews_id = NULL;
d8acc1
 
d8acc1
 				if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
d8acc1
@@ -2674,7 +2676,7 @@ ecb_ews_save_component_sync (ECalMetaBac
d8acc1
 					success = FALSE;
d8acc1
 				} else {
d8acc1
 					item = g_object_ref (item);
d8acc1
-					ews_id = e_ews_item_get_id (item);
d8acc1
+					ews_id = e_ews_id_copy (e_ews_item_get_id (item));
d8acc1
 				}
d8acc1
 			}
d8acc1
 
d8acc1
@@ -2689,13 +2691,21 @@ ecb_ews_save_component_sync (ECalMetaBac
d8acc1
 			g_warn_if_fail (ews_id != NULL);
d8acc1
 
d8acc1
 			if (ews_id && ecb_ews_extract_attachments (icalcomp, &info_attachments)) {
d8acc1
+				gchar *changekey = NULL;
d8acc1
 				GSList *ids = NULL;
d8acc1
 
d8acc1
 				success = e_ews_connection_create_attachments_sync (cbews->priv->cnc, EWS_PRIORITY_MEDIUM,
d8acc1
-					ews_id, info_attachments, FALSE, NULL, &ids, cancellable, error);
d8acc1
+					ews_id, info_attachments, FALSE, &changekey, &ids, cancellable, error);
d8acc1
 
d8acc1
 				g_slist_free_full (info_attachments, (GDestroyNotify) e_ews_attachment_info_free);
d8acc1
 				g_slist_free_full (ids, g_free);
d8acc1
+
d8acc1
+				if (success && changekey) {
d8acc1
+					g_free (ews_id->change_key);
d8acc1
+					ews_id->change_key = changekey;
d8acc1
+				} else {
d8acc1
+					g_free (changekey);
d8acc1
+				}
d8acc1
 			}
d8acc1
 		}
d8acc1
 
d8acc1
@@ -2730,6 +2740,7 @@ ecb_ews_save_component_sync (ECalMetaBac
d8acc1
 		}
d8acc1
 
d8acc1
 		icalcomponent_free (icalcomp);
d8acc1
+		e_ews_id_free (ews_id);
d8acc1
 		g_clear_object (&item);
d8acc1
 
d8acc1
 		for (link = (GSList *) instances; link && success; link = g_slist_next (link)) {
d8acc1
diff -up evolution-ews-3.28.5/src/server/e-ews-item.c.meeting-with-attachment evolution-ews-3.28.5/src/server/e-ews-item.c
d8acc1
--- evolution-ews-3.28.5/src/server/e-ews-item.c.meeting-with-attachment	2018-09-27 18:32:25.785038625 +0200
d8acc1
+++ evolution-ews-3.28.5/src/server/e-ews-item.c	2018-09-27 18:32:25.787038625 +0200
d8acc1
@@ -2695,3 +2695,28 @@ e_ews_item_util_strip_ex_address (const
d8acc1
 
d8acc1
 	return ex_address;
d8acc1
 }
d8acc1
+
d8acc1
+EwsId *
d8acc1
+e_ews_id_copy (const EwsId *ews_id)
d8acc1
+{
d8acc1
+	EwsId *copy;
d8acc1
+
d8acc1
+	if (!ews_id)
d8acc1
+		return NULL;
d8acc1
+
d8acc1
+	copy = g_new0 (EwsId, 1);
d8acc1
+	copy->id = g_strdup (ews_id->id);
d8acc1
+	copy->change_key = g_strdup (ews_id->change_key);
d8acc1
+
d8acc1
+	return copy;
d8acc1
+}
d8acc1
+
d8acc1
+void
d8acc1
+e_ews_id_free (EwsId *ews_id)
d8acc1
+{
d8acc1
+	if (ews_id) {
d8acc1
+		g_free (ews_id->id);
d8acc1
+		g_free (ews_id->change_key);
d8acc1
+		g_free (ews_id);
d8acc1
+	}
d8acc1
+}
d8acc1
diff -up evolution-ews-3.28.5/src/server/e-ews-item.h.meeting-with-attachment evolution-ews-3.28.5/src/server/e-ews-item.h
d8acc1
--- evolution-ews-3.28.5/src/server/e-ews-item.h.meeting-with-attachment	2018-07-30 16:01:00.000000000 +0200
d8acc1
+++ evolution-ews-3.28.5/src/server/e-ews-item.h	2018-09-27 18:32:25.787038625 +0200
d8acc1
@@ -384,6 +384,8 @@ void		e_ews_permissions_free (GSList *pe
d8acc1
 /* Utility functions */
d8acc1
 const gchar *	e_ews_item_util_strip_ex_address
d8acc1
 						(const gchar *ex_address);
d8acc1
+EwsId *		e_ews_id_copy			(const EwsId *ews_id);
d8acc1
+void		e_ews_id_free			(EwsId *ews_id);
d8acc1
 
d8acc1
 G_END_DECLS
d8acc1