[evolution-ews/gnome-3-8] Handle inlined attachments in e_ews_connection_{create, get}_attachments



commit 28495cc37a0121b231c33b85d7629c67f87c42cc
Author: Fabiano Fidêncio <fidencio redhat com>
Date:   Thu Apr 18 04:00:34 2013 +0200

    Handle inlined attachments in e_ews_connection_{create,get}_attachments
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654950

 src/calendar/e-cal-backend-ews.c |   40 +++++--
 src/server/e-ews-connection.c    |  255 ++++++++++++++++++++++++++++++--------
 src/server/e-ews-item.c          |   65 ++++++----
 src/server/e-ews-item.h          |   50 +++++++-
 4 files changed, 323 insertions(+), 87 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index b2567f7..cffa29e 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -1607,6 +1607,7 @@ ews_create_object_cb (GObject *object,
        /* attachments */
        n_attach = e_cal_component_get_num_attachments (create_data->comp);
        if (n_attach > 0) {
+               GSList *info_attachments = NULL;
                EwsAttachmentsData *attach_data = g_new0 (EwsAttachmentsData, 1);
 
                attach_data->cbews = g_object_ref (create_data->cbews);
@@ -1616,15 +1617,22 @@ ews_create_object_cb (GObject *object,
                attach_data->cb_type = 1;
 
                e_cal_component_get_attachment_list (create_data->comp, &attachments);
+
+               for (i = attachments; i; i = i->next) {
+                       EEwsAttachmentInfo *info = e_ews_attachment_info_new (E_EWS_ATTACHMENT_INFO_TYPE_URI);
+                       e_ews_attachment_info_set_uri (info, i->data);
+                       info_attachments = g_slist_append (info_attachments, info);
+               }
+
                e_ews_connection_create_attachments (
                        cnc, EWS_PRIORITY_MEDIUM,
-                       item_id, attachments,
+                       item_id, info_attachments,
                        priv->cancellable,
                        ews_create_attachments_cb,
                        attach_data);
 
-               for (i = attachments; i; i = i->next) g_free (i->data);
-               g_slist_free (attachments);
+               g_slist_free_full (info_attachments, (GDestroyNotify) e_ews_attachment_info_free);
+               g_slist_free_full (attachments, g_free);
        }
 
        /* get exclusive access to the store */
@@ -2461,6 +2469,7 @@ e_cal_backend_ews_modify_object (ECalBackend *backend,
 
        /*in case we have a new attachmetns the update item will be preformed in ews_create_attachments_cb*/
        if (added_attachments) {
+               GSList *info_attachments = NULL;
                EwsId *item_id = g_new0 (EwsId, 1);
                item_id->id = itemid;
                item_id->change_key = changekey;
@@ -2475,6 +2484,13 @@ e_cal_backend_ews_modify_object (ECalBackend *backend,
                attach_data->itemid = itemid;
                attach_data->changekey = changekey;
 
+               for (i = added_attachments; i; i = i->next) {
+                       EEwsAttachmentInfo *info = e_ews_attachment_info_new (E_EWS_ATTACHMENT_INFO_TYPE_URI);
+                       e_ews_attachment_info_set_uri (info, i->data);
+
+                       info_attachments = g_slist_append (info_attachments, info);
+               }
+
                if (context) {
                        convert_error_to_edc_error (&error);
                        e_data_cal_respond_modify_objects (cal, context, error, NULL, NULL);
@@ -2482,11 +2498,12 @@ e_cal_backend_ews_modify_object (ECalBackend *backend,
 
                e_ews_connection_create_attachments (
                        priv->cnc, EWS_PRIORITY_MEDIUM,
-                       item_id, added_attachments,
+                       item_id, info_attachments,
                        cancellable,
                        ews_create_attachments_cb,
                        attach_data);
 
+               g_slist_free_full (info_attachments, (GDestroyNotify) e_ews_attachment_info_free);
                g_slist_free (added_attachments);
                g_free (item_id);
 
@@ -3109,11 +3126,11 @@ ews_get_attachments (ECalBackendEws *cbews,
                      EEwsItem *item)
 {
        gboolean has_attachment = FALSE;
-       const GSList *attachment_ids, *aid;
+       const GSList *attachment_ids, *aid, *l;
        const EwsId *item_id;
        ECalComponent *comp;
        const gchar *uid;
-       GSList *uris = NULL;
+       GSList *uris = NULL, *info_attachments = NULL;
 
        e_ews_item_has_attachments (item, &has_attachment);
        if (!has_attachment)
@@ -3133,7 +3150,6 @@ ews_get_attachments (ECalBackendEws *cbews,
        e_cal_component_get_uid (comp, &uid);
 
        attachment_ids = e_ews_item_get_attachments_ids (item);
-
        if (e_ews_connection_get_attachments_sync (
                cbews->priv->cnc,
                EWS_PRIORITY_MEDIUM,
@@ -3141,7 +3157,7 @@ ews_get_attachments (ECalBackendEws *cbews,
                attachment_ids,
                cbews->priv->storage_path,
                TRUE,
-               &uris,
+               &info_attachments,
                NULL, NULL,
                cbews->priv->cancellable,
                NULL)) {
@@ -3151,6 +3167,13 @@ ews_get_attachments (ECalBackendEws *cbews,
                ECalComponentId *id;
                ECalComponent *cache_comp;
 
+               for (l = info_attachments; l; l = l->next) {
+                       EEwsAttachmentInfo *info = l->data;
+                       const gchar *uri = e_ews_attachment_info_get_uri (info);
+
+                       uris = g_slist_append (uris, g_strdup (uri));
+               }
+
                e_cal_component_set_attachment_list (comp, uris);
 
                icalcomp = e_cal_component_get_icalcomponent (comp);
@@ -3171,6 +3194,7 @@ ews_get_attachments (ECalBackendEws *cbews,
                        e_cal_backend_notify_component_modified (E_CAL_BACKEND (cbews), cache_comp, comp);
 
                g_slist_free_full (uris, g_free);
+               g_slist_free_full (info_attachments, (GDestroyNotify) e_ews_attachment_info_free);
        }
 
        PRIV_UNLOCK (cbews->priv);
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 4495144..e8faf0b 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1573,6 +1573,130 @@ ews_delegate_info_free (EwsDelegateInfo *info)
        g_free (info);
 }
 
+EEwsAttachmentInfo *
+e_ews_attachment_info_new (EEwsAttachmentInfoType type)
+{
+       EEwsAttachmentInfo *info;
+       info = g_new0 (EEwsAttachmentInfo, 1);
+
+       info->type = type;
+       return info;
+}
+
+void
+e_ews_attachment_info_free (EEwsAttachmentInfo *info)
+{
+       if (!info)
+               return;
+
+       switch (info->type) {
+       case E_EWS_ATTACHMENT_INFO_TYPE_INLINED:
+               g_free (info->data.inlined.filename);
+               g_free (info->data.inlined.mime_type);
+               g_free (info->data.inlined.data);
+               break;
+       case E_EWS_ATTACHMENT_INFO_TYPE_URI:
+               g_free (info->data.uri);
+               break;
+       default:
+               g_warning ("Unknown EEwsAttachmentInfoType %d", info->type);
+               break;
+       }
+
+       g_free (info);
+}
+
+EEwsAttachmentInfoType
+e_ews_attachment_info_get_type (EEwsAttachmentInfo *info)
+{
+       return info->type;
+}
+
+const gchar *
+e_ews_attachment_info_get_inlined_data (EEwsAttachmentInfo *info,
+                                       gsize *len)
+{
+       g_return_val_if_fail (info != NULL, NULL);
+       g_return_val_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_INLINED, NULL);
+
+       *len = info->data.inlined.length;
+       return info->data.inlined.data;
+}
+
+void
+e_ews_attachment_info_set_inlined_data (EEwsAttachmentInfo *info,
+                                       const guchar *data,
+                                       gsize len)
+{
+       g_return_if_fail (info != NULL);
+       g_return_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_INLINED);
+
+       info->data.inlined.data = g_malloc (len);
+       memcpy (info->data.inlined.data, data, len);
+       info->data.inlined.length = len;
+}
+
+const gchar *
+e_ews_attachment_info_get_mime_type (EEwsAttachmentInfo *info)
+{
+       g_return_val_if_fail (info != NULL, NULL);
+       g_return_val_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_INLINED, NULL);
+
+       return info->data.inlined.mime_type;
+}
+
+void
+e_ews_attachment_info_set_mime_type (EEwsAttachmentInfo *info,
+                                    const gchar *mime_type)
+{
+       g_return_if_fail (info != NULL);
+       g_return_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_INLINED);
+
+       g_free (info->data.inlined.mime_type);
+       info->data.inlined.mime_type = g_strdup (mime_type);
+}
+
+const gchar *
+e_ews_attachment_info_get_filename (EEwsAttachmentInfo *info)
+{
+       g_return_val_if_fail (info != NULL, NULL);
+       g_return_val_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_INLINED, NULL);
+
+       return info->data.inlined.filename;
+}
+
+void
+e_ews_attachment_info_set_filename (EEwsAttachmentInfo *info,
+                                   const gchar *filename)
+{
+       g_return_if_fail (info != NULL);
+       g_return_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_INLINED);
+
+       g_free (info->data.inlined.filename);
+       info->data.inlined.filename = g_strdup (filename);
+}
+
+
+const gchar *
+e_ews_attachment_info_get_uri (EEwsAttachmentInfo *info)
+{
+       g_return_val_if_fail (info != NULL, NULL);
+       g_return_val_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_URI, NULL);
+
+       return info->data.uri;
+}
+
+void
+e_ews_attachment_info_set_uri (EEwsAttachmentInfo *info,
+                              const gchar *uri)
+{
+       g_return_if_fail (info != NULL);
+       g_return_if_fail (info->type == E_EWS_ATTACHMENT_INFO_TYPE_URI);
+
+       g_free (info->data.uri);
+       info->data.uri = g_strdup (uri);
+}
+
 /* Connection APIS */
 
 /**
@@ -5572,55 +5696,72 @@ create_attachments_response_cb (ESoapResponse *response,
        }
 }
 
-static void
+static gboolean
 e_ews_connection_attach_file (ESoapMessage *msg,
-                              const gchar *uri)
-{
-       /* TODO - handle a situation where the file isnt accessible/other problem with it */
-       /* TODO - This is a naive implementation that just uploads the whole content into memory, ie very 
inefficient */
-       struct stat st;
-       gchar *buffer, *filepath;
-       const gchar *filename;
-       gint fd;
+                              EEwsAttachmentInfo *info,
+                             GError **error)
+{
+       EEwsAttachmentInfoType type = e_ews_attachment_info_get_type (info);
+       gchar *filename = NULL, *buffer = NULL;
+       const gchar *content = NULL;
+       gsize length;
+
+       switch (type) {
+               case E_EWS_ATTACHMENT_INFO_TYPE_URI: {
+                       /* TODO - handle a situation where the file isnt accessible/other problem with it */
+                       /* TODO - This is a naive implementation that just uploads the whole content into */
+                       /*        memory, ie very inefficient */
+                       const gchar *uri;
+                       gchar *filepath;
+                       GError *local_error = NULL;
+
+                       uri = e_ews_attachment_info_get_uri (info);
+
+                       /* convert uri to actual file path */
+                       filepath = g_filename_from_uri (uri, NULL, &local_error);
+                       if (local_error != NULL) {
+                               g_propagate_error (error, local_error);
+                               return FALSE;
+                       }
 
-       /* convert uri to actual file path */
-       filepath = g_filename_from_uri (uri, NULL, NULL);
+                       g_file_get_contents (uri, &buffer, &length, &local_error);
+                       if (local_error != NULL) {
+                               g_free (filepath);
+                               g_propagate_error (error, local_error);
+                               return FALSE;
+                       }
 
-       if (stat (filepath, &st) == -1) {
-               g_warning ("Error while calling stat() on %s\n", filepath);
-               return;
-       }
+                       content = buffer;
 
-       fd = open (filepath, O_RDONLY);
-       if (fd == -1) {
-               g_warning ("Error opening %s for reading\n", filepath);
-               return;
-       }
+                       filename = strrchr (filepath, G_DIR_SEPARATOR);
+                       filename = filename ? g_strdup (++filename) : g_strdup (filepath);
 
-       buffer = malloc (st.st_size);
-       if (read (fd, buffer, st.st_size) != st.st_size) {
-               g_warning ("Error reading %u bytes from %s\n", (guint) st.st_size, filepath);
-               close (fd);
-               return;
+                       g_free (filepath);
+                       break;
+               }
+               case E_EWS_ATTACHMENT_INFO_TYPE_INLINED:
+                       content = e_ews_attachment_info_get_inlined_data (info, &length);
+                       filename = g_strdup (e_ews_attachment_info_get_filename (info));
+                       break;
+               default:
+                       g_warning ("Unknown EwsAttachmentInfoType %d", type);
+                       return FALSE;
        }
-       close (fd);
-
-       filename = strrchr (filepath, '/');
-       if (filename) filename++;
-       else filename = filepath;
 
        e_soap_message_start_element (msg, "FileAttachment", NULL, NULL);
 
        e_ews_message_write_string_parameter (msg, "Name", NULL, filename);
 
        e_soap_message_start_element (msg, "Content", NULL, NULL);
-       e_soap_message_write_base64 (msg, buffer, st.st_size);
+       e_soap_message_write_base64 (msg, content, length);
        e_soap_message_end_element (msg); /* "Content" */
 
        e_soap_message_end_element (msg); /* "FileAttachment" */
 
-       free (filepath);
-       free (buffer);
+       g_free (filename);
+       g_free (buffer);
+
+       return TRUE;
 }
 
 void
@@ -5636,9 +5777,18 @@ e_ews_connection_create_attachments (EEwsConnection *cnc,
        GSimpleAsyncResult *simple;
        EwsAsyncData *async_data;
        const GSList *l;
+       GError *local_error = NULL;
 
        g_return_if_fail (cnc != NULL);
 
+       simple = g_simple_async_result_new (
+               G_OBJECT (cnc), callback, user_data,
+               e_ews_connection_create_attachments);
+
+       async_data = g_new0 (EwsAsyncData, 1);
+       g_simple_async_result_set_op_res_gpointer (
+               simple, async_data, (GDestroyNotify) async_data_free);
+
        msg = e_ews_message_new_with_header (cnc->priv->uri, cnc->priv->impersonate_user, "CreateAttachment", 
NULL, NULL, EWS_EXCHANGE_2007_SP1);
 
        e_soap_message_start_element (msg, "ParentItemId", "messages", NULL);
@@ -5651,20 +5801,19 @@ e_ews_connection_create_attachments (EEwsConnection *cnc,
        e_soap_message_start_element (msg, "Attachments", "messages", NULL);
 
        for (l = files; l != NULL; l = g_slist_next (l))
-               e_ews_connection_attach_file (msg, l->data);
+               if (!e_ews_connection_attach_file (msg, l->data, &local_error)) {
+                       if (local_error != NULL)
+                               g_simple_async_result_take_error (simple, local_error);
+                       g_simple_async_result_complete_in_idle (simple);
+                       g_object_unref (simple);
+
+                       return;
+               }
 
        e_soap_message_end_element (msg); /* "Attachments" */
 
        e_ews_message_write_footer (msg);
 
-       simple = g_simple_async_result_new (
-               G_OBJECT (cnc), callback, user_data,
-               e_ews_connection_create_attachments);
-
-       async_data = g_new0 (EwsAsyncData, 1);
-       g_simple_async_result_set_op_res_gpointer (
-               simple, async_data, (GDestroyNotify) async_data_free);
-
        e_ews_connection_queue_request (
                cnc, msg, create_attachments_response_cb,
                pri, cancellable, simple);
@@ -5894,7 +6043,8 @@ ews_handle_attachments_param (ESoapParameter *param,
                               EwsAsyncData *async_data)
 {
        ESoapParameter *subparam, *attspara;
-       gchar *uri = NULL, *attach_id = NULL;
+       EEwsAttachmentInfo *info = NULL;
+       gchar *attach_id = NULL;
        EEwsItem *item;
        const gchar *name;
 
@@ -5906,18 +6056,21 @@ ews_handle_attachments_param (ESoapParameter *param,
                if (!g_ascii_strcasecmp (name, "ItemAttachment")) {
                        item = e_ews_item_new_from_soap_parameter (subparam);
                        attach_id = g_strdup (e_ews_item_get_attachment_id (item)->id);
-                       uri = e_ews_item_dump_mime_content (item, async_data->directory);
+                       info = e_ews_item_dump_mime_content (item, async_data->directory);
 
+               } else if (!g_ascii_strcasecmp (name, "FileAttachment")) {
+                       info = e_ews_dump_file_attachment_from_soap_parameter (subparam, 
async_data->directory, async_data->sync_state, &attach_id);
                }
-               else if (!g_ascii_strcasecmp (name, "FileAttachment")) {
-                       uri = e_ews_dump_file_attachment_from_soap_parameter (subparam, 
async_data->directory, async_data->sync_state, &attach_id);
-               }
-               if (uri && attach_id) {
-                       async_data->items = g_slist_append (async_data->items, uri);
+
+               if (info && attach_id) {
+                       async_data->items = g_slist_append (async_data->items, info);
                        async_data->items_created = g_slist_append (async_data->items_created, attach_id);
-                       uri = NULL;
-                       attach_id = NULL;
+               } else {
+                       e_ews_attachment_info_free (info);
+                       g_free (attach_id);
                }
+               info = NULL;
+               attach_id = NULL;
        }
 }
 
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index 5f30b56..538b965 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -32,7 +32,6 @@
 #include <glib/gprintf.h>
 #include <libsoup/soup-misc.h>
 #include "e-ews-item.h"
-#include "e-ews-connection.h"
 #include "e-ews-message.h"
 
 #ifdef G_OS_WIN32
@@ -1522,18 +1521,19 @@ e_ews_embed_attachment_id_in_uri (const gchar *olduri,
        return g_filename_to_uri (filename, NULL, NULL);
 }
 
-gchar *
+EEwsAttachmentInfo *
 e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param,
                                                 const gchar *cache,
                                                 const gchar *comp_uid,
                                                 gchar **attach_id)
 {
        ESoapParameter *subparam;
-       const gchar *param_name;
+       const gchar *param_name, *tmpfilename;
        gchar *name = NULL, *value, *filename, *dirname;
        guchar *content = NULL;
        gsize data_len = 0;
-       gchar *tmpdir, *tmpfilename;
+       gchar *tmpdir;
+       EEwsAttachmentInfo *info;
 
        g_return_val_if_fail (param != NULL, NULL);
 
@@ -1563,36 +1563,46 @@ e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param,
                return NULL;
        }
 
-       tmpfilename = (gchar *) content;
-       tmpdir = g_strndup (tmpfilename, g_strrstr (tmpfilename, "/") - tmpfilename);
+       if (cache) {
+               info = e_ews_attachment_info_new (E_EWS_ATTACHMENT_INFO_TYPE_URI);
 
-       dirname = g_build_filename (tmpdir, comp_uid, NULL);
-       if (g_mkdir_with_parents (dirname, 0775) == -1) {
-               g_warning ("Failed create directory to place file in [%s]: %s\n", dirname, strerror (errno));
-       }
+               tmpfilename = (gchar *) content;
+               tmpdir = g_strndup (tmpfilename, g_strrstr (tmpfilename, "/") - tmpfilename);
 
-       filename = g_build_filename (dirname, name, NULL);
-       if (g_rename (tmpfilename, filename) != 0) {
-               g_warning ("Failed to move attachment cache file [%s -> %s]: %s\n", tmpfilename, filename, 
strerror (errno));
-       }
+               dirname = g_build_filename (tmpdir, comp_uid, NULL);
+               if (g_mkdir_with_parents (dirname, 0775) == -1) {
+                       g_warning ("Failed create directory to place file in [%s]: %s\n", dirname, strerror 
(errno));
+               }
 
-       g_free (dirname);
-       g_free (tmpdir);
-       g_free (name);
-       g_free (content);
+               filename = g_build_filename (dirname, name, NULL);
+               if (g_rename (tmpfilename, filename) != 0) {
+                       g_warning ("Failed to move attachment cache file [%s -> %s]: %s\n",
+                                       tmpfilename, filename, strerror (errno));
+               }
 
-       /* Return URI to saved file */
-       name = g_filename_to_uri (filename, NULL, NULL);
-       g_free (filename);
-       return name;
+               g_free (dirname);
+               g_free (tmpdir);
+               g_free (name);
+               g_free (content);
+
+               /* Return URI to saved file */
+               e_ews_attachment_info_set_uri (info, g_filename_to_uri (filename, NULL, NULL));
+               g_free (filename);
+       } else {
+               info = e_ews_attachment_info_new (E_EWS_ATTACHMENT_INFO_TYPE_INLINED);
+               e_ews_attachment_info_set_inlined_data (info, content, data_len);
+       }
+       return info;
 }
 
-gchar *
+EEwsAttachmentInfo *
 e_ews_item_dump_mime_content (EEwsItem *item,
                               const gchar *cache)
 {
+       EEwsAttachmentInfo *info = e_ews_attachment_info_new (E_EWS_ATTACHMENT_INFO_TYPE_URI);
        gchar *filename, *surename, *dirname;
-       gchar *tmpdir, *tmpfilename;
+       gchar *tmpdir, *uri;
+       const gchar *tmpfilename;
 
        g_return_val_if_fail (item->priv->mime_content != NULL, NULL);
 
@@ -1610,14 +1620,17 @@ e_ews_item_dump_mime_content (EEwsItem *item,
                g_warning ("Failed to move attachment cache file");
        }
 
+       uri = g_filename_to_uri (filename, NULL, NULL);
+       e_ews_attachment_info_set_uri (info, uri);
+
+       g_free (uri);
        g_free (filename);
        g_free (dirname);
        g_free (tmpdir);
-       g_free (tmpfilename);
        g_free (surename);
 
        /* Return URI to saved file */
-       return g_filename_to_uri (filename, NULL, NULL);
+       return info;
 }
 
 const GSList *
diff --git a/src/server/e-ews-item.h b/src/server/e-ews-item.h
index c92f001..220c517 100644
--- a/src/server/e-ews-item.h
+++ b/src/server/e-ews-item.h
@@ -114,6 +114,26 @@ typedef struct {
        gchar *postal_code;
 } EwsAddress;
 
+typedef struct {
+       gchar *filename;
+       gchar *mime_type;
+       gsize length;
+       gchar *data;
+} EEwsAttachmentInline;
+
+typedef enum {
+       E_EWS_ATTACHMENT_INFO_TYPE_INLINED,
+       E_EWS_ATTACHMENT_INFO_TYPE_URI
+} EEwsAttachmentInfoType;
+
+typedef struct {
+       EEwsAttachmentInfoType type;
+       union {
+               EEwsAttachmentInline inlined;
+               gchar *uri;
+       } data;
+} EEwsAttachmentInfo;
+
 typedef enum {
        E_EWS_PERMISSION_BIT_FREE_BUSY_DETAILED = 0x00001000,
        E_EWS_PERMISSION_BIT_FREE_BUSY_SIMPLE   = 0x00000800,
@@ -203,13 +223,13 @@ const GSList *    e_ews_item_get_modified_occurrences
 gchar *                e_ews_embed_attachment_id_in_uri (const gchar *olduri, const gchar *attach_id);
 GSList *       e_ews_item_get_attachments_ids
                                                (EEwsItem *item);
-gchar *
+EEwsAttachmentInfo *
 e_ews_dump_file_attachment_from_soap_parameter (ESoapParameter *param, const gchar *cache, const gchar 
*comp_uid, gchar **attach_id);
 
 gchar *
 e_ews_item_ical_dump (EEwsItem *item);
 
-gchar *
+EEwsAttachmentInfo *
 e_ews_item_dump_mime_content (EEwsItem *item, const gchar *cache);
 
 const GSList * e_ews_item_get_attendees        (EEwsItem *item);
@@ -217,6 +237,32 @@ const GSList *     e_ews_item_get_attendees        (EEwsItem *item);
 const EwsId *  e_ews_item_get_calendar_item_accept_id
                                                (EEwsItem *item);
 
+EEwsAttachmentInfo *
+               e_ews_attachment_info_new               (EEwsAttachmentInfoType type);
+void           e_ews_attachment_info_free      (EEwsAttachmentInfo *info);
+EEwsAttachmentInfoType
+               e_ews_attachment_info_get_type  (EEwsAttachmentInfo *info);
+const gchar *  e_ews_attachment_info_get_inlined_data
+                                               (EEwsAttachmentInfo *info,
+                                                gsize *len);
+void           e_ews_attachment_info_set_inlined_data
+                                               (EEwsAttachmentInfo *info,
+                                                const guchar *data,
+                                                gsize len);
+const gchar *  e_ews_attachment_info_get_mime_type
+                                               (EEwsAttachmentInfo *info);
+void           e_ews_attachment_info_set_mime_type
+                                               (EEwsAttachmentInfo *info,
+                                                const gchar *mime_type);
+const gchar *  e_ews_attachment_info_get_filename
+                                               (EEwsAttachmentInfo *info);
+void           e_ews_attachment_info_set_filename
+                                               (EEwsAttachmentInfo *info,
+                                                const gchar *filename);
+const gchar *  e_ews_attachment_info_get_uri   (EEwsAttachmentInfo *info);
+void           e_ews_attachment_info_set_uri   (EEwsAttachmentInfo *info,
+                                                const gchar *uri);
+
 /* Contact fields */
 const gchar *  e_ews_item_get_fileas           (EEwsItem *item);
 const EwsCompleteName *


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