[evolution-ews] Clean up the ical form X-EVOLUTION-ITEMID and X-EVOLUTION-CHANGEKEY properties



commit 1aaf7d4cbac4b806394ed55946e524319cb55f94
Author: Pavel Ocheretny <pavel ocheretny intel com>
Date:   Mon Aug 29 10:26:30 2011 +0300

    Clean up the ical form X-EVOLUTION-ITEMID and X-EVOLUTION-CHANGEKEY properties

 src/calendar/e-cal-backend-ews-utils.c |   22 ++++++++++++++++++++++
 src/calendar/e-cal-backend-ews-utils.h |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index ec59845..d1766b4 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -669,3 +669,25 @@ gchar *e_ews_extract_attachment_id_from_uri (const gchar *uri)
 
 	return attachment_id;
 }
+
+void e_ews_clean_icalcomponent (icalcomponent *icalcomp)
+{
+	icalproperty *prop, *item_id_prop = NULL, *changekey_prop = NULL;
+
+	prop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+	while (prop) {
+		const gchar *x_name = icalproperty_get_x_name (prop);
+		if (!g_ascii_strcasecmp (x_name, "X-EVOLUTION-ITEMID"))
+			item_id_prop = prop;
+		 else if (!g_ascii_strcasecmp (x_name, "X-EVOLUTION-CHANGEKEY"))
+			changekey_prop = prop;
+
+		prop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
+	}
+
+	if (item_id_prop != NULL)
+		icalcomponent_remove_property (icalcomp, item_id_prop);
+
+	if (changekey_prop != NULL)
+		icalcomponent_remove_property (icalcomp, changekey_prop);
+}
diff --git a/src/calendar/e-cal-backend-ews-utils.h b/src/calendar/e-cal-backend-ews-utils.h
index a3a44ea..407f2a7 100644
--- a/src/calendar/e-cal-backend-ews-utils.h
+++ b/src/calendar/e-cal-backend-ews-utils.h
@@ -43,6 +43,7 @@ void ewscal_get_attach_differences (const GSList *original, const GSList *modifi
 gchar *e_ews_extract_attachment_id_from_uri (const gchar *uri);
 void ews_set_alarm (ESoapMessage *msg, ECalComponent *comp);
 gint ews_get_alarm (ECalComponent *comp);
+void e_ews_clean_icalcomponent (icalcomponent *icalcomp);
 
 G_END_DECLS
 



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