[evolution-ews] Kill X-EVOLUTION-ACCEPT-ID field; we just use X-EVOLUTION-ITEM-ID



commit e00cd8506d345b3590be823a2eb0ba5da98eb0c9
Author: David Woodhouse <David Woodhouse intel com>
Date:   Sat Jul 30 13:51:23 2011 +0100

    Kill X-EVOLUTION-ACCEPT-ID field; we just use X-EVOLUTION-ITEM-ID
    
    It's not clear how the receive_objects code will ever cope if we are asked
    to accept an item that *didn't* have an AssociatedCalendarItemId; the old
    code was just using the UID in that case, but I think that was expected to
    fail. Do the same for now... weren't we working on fixing this?

 src/calendar/e-cal-backend-ews.c |   41 +++++++++----------------------------
 src/camel/camel-ews-folder.c     |   14 ++++--------
 2 files changed, 15 insertions(+), 40 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index f68e9ed..9267668 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -595,36 +595,6 @@ ews_cal_component_get_item_id (ECalComponent *comp, gchar **itemid, gchar **chan
 		*changekey = ck;
 }
 
-/* changekey can be NULL if you don't want it. itemid cannot. */
-static void
-ews_cal_component_get_calendar_item_accept_id (ECalComponent *comp, gchar **itemid, gchar **changekey)
-{
-	icalproperty *prop;
-	const gchar *id = NULL;
-	*itemid = NULL;
-
-	prop = icalcomponent_get_first_property (e_cal_component_get_icalcomponent (comp),
-		ICAL_X_PROPERTY);
-	while (prop) {
-		const gchar *x_name, *x_val;
-
-		x_name = icalproperty_get_x_name (prop);
-		x_val = icalproperty_get_x (prop);
-		if (!g_ascii_strcasecmp (x_name, "X-EVOLUTION-CHANGEKEY")) {
-			*changekey = g_strdup (x_val);
-		} else if (!g_ascii_strcasecmp (x_name, "X-EVOLUTION-ACCEPT-ID")) {
-			*itemid = g_strdup (x_val);
-		}
-
-		prop = icalcomponent_get_next_property (e_cal_component_get_icalcomponent (comp),
-			ICAL_X_PROPERTY);
-	}
-	if (!*itemid){
-		e_cal_component_get_uid(comp, &id);
-		*itemid = g_strdup (id);
-	}
-}
-
 
 static void
 add_comps_to_item_id_hash (ECalBackendEws *cbews)
@@ -2152,7 +2122,16 @@ e_cal_backend_ews_receive_objects (ECalBackend *backend, EDataCal *cal, EServerM
 
 		/*getting a data for meeting request response*/
 		response_type = e_ews_get_current_user_meeting_reponse (e_cal_component_get_icalcomponent (comp), priv->user_email);
-		ews_cal_component_get_calendar_item_accept_id (comp, &item_id, &change_key);
+		ews_cal_component_get_item_id (comp, &item_id, &change_key);
+		if (!item_id) {
+			/* FIXME: How does Exchange even cope with this case? Don't we have to
+			   do something completely different if there's no AssociatedCalendarItemId
+			   in the email we received? Or if we received the email through a route
+			   other than an Exchange mailbox? */
+			const gchar *id;
+			e_cal_component_get_uid (comp, &id);
+			item_id = g_strdup (id);
+		}
 
 		switch (method) {
 			case ICAL_METHOD_REQUEST:
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index a169f3c..3b0a9fc 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -233,7 +233,7 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
 			g_object_unref (tmpstream);
 			goto exit_msg;
 		}
-		/* Replace original random UID with AssociatedCalendarItemId (ItemId) */
+		/* Add details of AssociatedCalendarItemId */
 		ba = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (tmpstream));
 		g_byte_array_append (ba, (guint8 *) "\0", 1);
 		icalcomp = icalparser_parse_string ((gchar *) ba->data);
@@ -241,14 +241,10 @@ ews_update_mgtrequest_mime_calendar_itemid (const gchar* mime_fname, const EwsId
 		icalprop = icalproperty_new_x (item_id->change_key);
 		icalproperty_set_x_name (icalprop, "X-EVOLUTION-CHANGEKEY");
 		icalcomponent_add_property (subcomp, icalprop);
-		if (is_calendar_UID){
-			icalcomponent_set_uid (icalcomp, (gchar *) item_id->id);
-		}
-		else {
-			icalprop = icalproperty_new_x (item_id->id);
-			icalproperty_set_x_name (icalprop, "X-EVOLUTION-ACCEPT-ID");
-			icalcomponent_add_property (subcomp, icalprop);
-		}
+		icalprop = icalproperty_new_x (item_id->id);
+		icalproperty_set_x_name (icalprop, "X-EVOLUTION-ITEMID");
+		icalcomponent_add_property (subcomp, icalprop);
+
 		calstring_new = icalcomponent_as_ical_string_r (icalcomp);
 		camel_mime_part_set_content (mimepart,
 					     (const gchar*) calstring_new, strlen (calstring_new),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]