[evolution-exchange/gnome-2-28] Bug #601218 - Accepted meeting doesn't show attachments in calendar view
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-exchange/gnome-2-28] Bug #601218 - Accepted meeting doesn't show attachments in calendar view
- Date: Tue, 10 Nov 2009 13:31:14 +0000 (UTC)
commit e557afad1c038ca98009bbf8eeda0cca5d61d853
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 10 14:30:53 2009 +0100
Bug #601218 - Accepted meeting doesn't show attachments in calendar view
calendar/e-cal-backend-exchange-calendar.c | 17 ++++++++
calendar/e-cal-backend-exchange.c | 60 ++++++++++++++++++++++++++++
calendar/e-cal-backend-exchange.h | 1 +
3 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/calendar/e-cal-backend-exchange-calendar.c b/calendar/e-cal-backend-exchange-calendar.c
index 5cabed2..6efb6a0 100644
--- a/calendar/e-cal-backend-exchange-calendar.c
+++ b/calendar/e-cal-backend-exchange-calendar.c
@@ -1662,6 +1662,14 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
} else {
gchar *new_object = NULL;
CalObjModType mod = CALOBJ_MOD_ALL;
+ GSList *attachment_list;
+
+ attachment_list = receive_attachments (cbex, comp);
+ if (attachment_list) {
+ e_cal_component_set_attachment_list (comp, attachment_list);
+ g_slist_foreach (attachment_list, (GFunc) g_free, NULL);
+ g_slist_free (attachment_list);
+ }
if (e_cal_util_component_is_instance (subcomp))
mod = CALOBJ_MOD_THIS;
@@ -1686,6 +1694,15 @@ receive_objects (ECalBackendSync *backend, EDataCal *cal,
g_free (old_object);
} else if (!check_owner_partstatus_for_declined (backend, subcomp)) {
gchar *returned_uid, *object;
+ GSList *attachment_list;
+
+ attachment_list = receive_attachments (cbex, comp);
+ if (attachment_list) {
+ e_cal_component_set_attachment_list (comp, attachment_list);
+ g_slist_foreach (attachment_list, (GFunc) g_free, NULL);
+ g_slist_free (attachment_list);
+ }
+
d(printf ("object : %s .. not found in the cache\n", uid));
icalobj = (gchar *) icalcomponent_as_ical_string_r (subcomp);
d(printf ("Create a new object : %s\n", icalobj));
diff --git a/calendar/e-cal-backend-exchange.c b/calendar/e-cal-backend-exchange.c
index 031ded6..c803452 100644
--- a/calendar/e-cal-backend-exchange.c
+++ b/calendar/e-cal-backend-exchange.c
@@ -1897,6 +1897,66 @@ get_mime_type (const gchar *uri)
return mime_type;
}
+/* copies attachments to the backend's attachment store and returns new list of attachment URLs */
+GSList *
+receive_attachments (ECalBackendExchange *cbex, ECalComponent *comp)
+{
+ GSList *attach_urls = NULL;
+ GSList *l, *attach_list = NULL;
+ const gchar *uid = NULL;
+
+ g_return_val_if_fail (cbex != NULL, NULL);
+ g_return_val_if_fail (comp != NULL, NULL);
+
+ if (!e_cal_component_has_attachments (comp))
+ return NULL;
+
+ e_cal_component_get_uid (comp, &uid);
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ e_cal_component_get_attachment_list (comp, &attach_list);
+ for (l = attach_list; l; l = l->next) {
+ gchar *fname, *dest_url, *attach_file = NULL, *file_contents;
+ gint len = 0;
+
+ if (!strncmp ((gchar *)l->data, "file://", 7)) {
+ fname = g_filename_from_uri ((gchar *)l->data, NULL, NULL);
+ attach_file = fname;
+ } else {
+ const gchar *filename;
+
+ fname = (gchar *)(l->data);
+ filename = g_strrstr (fname, "/");
+ if (!filename) {
+ /*
+ * some vcards contain e.g. ATTACH:CID:0fd601c67efb$ef66760d$_CDOEX
+ * -> ignore instead of crashing
+ */
+ continue;
+ }
+ attach_file = g_strdup_printf ("%s/%s-%s", cbex->priv->local_attachment_store, uid, filename + 1);
+ }
+
+ /* attach_file should be g_freed */
+ file_contents = get_attach_file_contents (fname, &len);
+ if (!file_contents) {
+ g_free (attach_file);
+ continue;
+ }
+
+ dest_url = save_attach_file (attach_file, file_contents, len);
+ g_free (attach_file);
+ g_free (file_contents);
+ if (!dest_url) {
+ continue;
+ }
+
+ attach_urls = g_slist_append (attach_urls, dest_url);
+ }
+
+ return attach_urls;
+}
+
gchar *
build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject, gchar **boundary)
{
diff --git a/calendar/e-cal-backend-exchange.h b/calendar/e-cal-backend-exchange.h
index 22980d0..03f8450 100644
--- a/calendar/e-cal-backend-exchange.h
+++ b/calendar/e-cal-backend-exchange.h
@@ -104,6 +104,7 @@ void e_cal_backend_exchange_get_sender (ECalBackendSync *backend, ECalComponent
gchar * e_cal_backend_exchange_get_sender_string (ECalBackendSync *backend, ECalComponent *comp);
gboolean e_cal_backend_exchange_is_online (ECalBackendExchange *cbex);
GSList * get_attachment (ECalBackendExchange *cbex, const gchar *uid, const gchar *body, gint len);
+GSList *receive_attachments (ECalBackendExchange *cbex, ECalComponent *comp);
void process_delegated_cal_object (icalcomponent *icalcomp, const gchar *delegator_name,
const gchar *delegator_email, const gchar *delegatee_email);
gchar * build_msg ( ECalBackendExchange *cbex, ECalComponent *comp, const gchar *subject, gchar **boundary);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]