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

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