[evolution-ews] Perform Createattachments operation in the callback of CreateItem in the calendar backend
- From: Or Goshen <ogosh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Perform Createattachments operation in the callback of CreateItem in the calendar backend
- Date: Sun, 5 Jun 2011 12:35:33 +0000 (UTC)
commit 9921dbe9e3459d287f9ebd22f7e64f07696c68b3
Author: Or Goshen <orx goshen intel com>
Date: Sun Jun 5 15:43:36 2011 +0300
Perform Createattachments operation in the callback of CreateItem in the calendar backend
src/calendar/e-cal-backend-ews.c | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index f6c894a..c48e1f5 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -1052,6 +1052,31 @@ convert_calcomp_to_xml(ESoapMessage *msg, gpointer user_data)
}
static void
+ews_create_attachments_cb(GObject *object, GAsyncResult *res, gpointer user_data)
+{
+ EEwsConnection *cnc = E_EWS_CONNECTION (object);
+ /*ECalComponent *comp = user_data;*/
+ GSList *ids = NULL, *next;
+ EwsAttachmentId *attach_id;
+ GError *error = NULL;
+
+ /* TODO - am I suppose to do anything with the ids I get back ? */
+ /* right now just free them */
+ ids = e_ews_connection_create_attachments_finish (cnc, res, &error);
+ for (next = ids; next; next = next->next) {
+ attach_id = next->data;
+
+ g_free (attach_id->id);
+ g_free (attach_id->rootItemId);
+ g_free (attach_id->rootItemChangeKey);
+
+ g_free (attach_id);
+ }
+
+ g_slist_free (ids);
+}
+
+static void
ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
{
EEwsConnection *cnc = E_EWS_CONNECTION (object);
@@ -1059,7 +1084,7 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
ECalBackendEws *cbews = create_data->cbews;
ECalBackendEwsPrivate *priv = cbews->priv;
GError *error = NULL;
- GSList *ids = NULL;
+ GSList *ids = NULL, *attachments = NULL;
const gchar *comp_uid;
const EwsId *item_id;
icalproperty *icalprop;
@@ -1087,6 +1112,14 @@ ews_create_object_cb(GObject *object, GAsyncResult *res, gpointer user_data)
icalcomp = e_cal_component_get_icalcomponent(create_data->comp);
icalcomponent_add_property (icalcomp, icalprop);
+ /* attachments */
+ if (e_cal_component_get_num_attachments (create_data->comp) > 0) {
+ e_cal_component_get_attachment_list (create_data->comp, &attachments);
+ e_ews_connection_create_attachments_start (cnc, EWS_PRIORITY_MEDIUM,
+ item_id, attachments,
+ ews_create_attachments_cb, NULL, create_data->comp);
+ }
+
/* update component internal data */
e_cal_component_commit_sequence(create_data->comp);
put_component_to_store (create_data->cbews, create_data->comp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]