[evolution-ews] Implement a function that extracts the attachment id embedded in attachments URI



commit 8272d4a258038b57320d6a0d76066a5bad816c4a
Author: Or Goshen <orx goshen intel com>
Date:   Thu Jul 14 15:14:46 2011 +0300

    Implement a function that extracts the attachment id embedded in attachments URI

 src/calendar/e-cal-backend-ews-utils.c |   15 +++++++++++++++
 src/calendar/e-cal-backend-ews-utils.h |    1 +
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index b63bf54..7489bfd 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -600,3 +600,18 @@ const char *e_ews_collect_orginizer(icalcomponent *comp)
 				org_email_address = org;
 	return org_email_address;
 }
+
+gchar *e_ews_extract_attachment_id_from_uri (const gchar *uri)
+{
+	gchar *attachment_id, *filepath = g_filename_from_uri (uri, NULL, NULL);
+	gchar **dirs = g_strsplit (filepath, "/", 0);
+	int n = 0;
+
+	while (dirs[n]) n++;
+
+	attachment_id = g_strdup (dirs[n-1]);
+
+	g_strfreev (dirs);
+
+	return attachment_id;
+}
diff --git a/src/calendar/e-cal-backend-ews-utils.h b/src/calendar/e-cal-backend-ews-utils.h
index 7e41adc..a070ebc 100644
--- a/src/calendar/e-cal-backend-ews-utils.h
+++ b/src/calendar/e-cal-backend-ews-utils.h
@@ -38,6 +38,7 @@ void ewscal_set_availability_timezone (ESoapMessage *msg, icaltimezone *icaltz);
 void ewscal_set_reccurence (ESoapMessage *msg, icalproperty *rrule, icaltimetype *dtstart);
 void ewscal_set_reccurence_exceptions (ESoapMessage *msg, icalcomponent *comp);
 void ewscal_get_attach_differences (const GSList *original, const GSList *modified, GSList **removed, GSList **added);
+gchar *e_ews_extract_attachment_id_from_uri (const gchar *uri);
 
 G_END_DECLS
 



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