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

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