aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/itip-utils.c
diff options
context:
space:
mode:
authorHarish Krishnaswamy <kharish@novell.com>2005-01-08 18:53:53 +0800
committerHarish Krishnaswamy <kharish@src.gnome.org>2005-01-08 18:53:53 +0800
commiteac831f58e75c6d8eb98972d3721d8e792490617 (patch)
tree7ee76cb7de187f51b8270cd9426ea0c14ec5506c /calendar/gui/itip-utils.c
parenteded2adbdb1ef63ade4c03920de113cd3abccf3a (diff)
downloadgsoc2013-evolution-eac831f58e75c6d8eb98972d3721d8e792490617.tar.gz
gsoc2013-evolution-eac831f58e75c6d8eb98972d3721d8e792490617.tar.zst
gsoc2013-evolution-eac831f58e75c6d8eb98972d3721d8e792490617.zip
Added support for attachments support to calendar items.
2005-01-08 Harish Krishnaswamy <kharish@novell.com> Added support for attachments support to calendar items. svn path=/trunk/; revision=28287
Diffstat (limited to 'calendar/gui/itip-utils.c')
-rw-r--r--calendar/gui/itip-utils.c65
1 files changed, 63 insertions, 2 deletions
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 9679cdcb45..36ddbea045 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -42,6 +42,7 @@
#include "e-util/e-passwords.h"
#include "calendar-config.h"
#include "itip-utils.h"
+#include "dialogs/cal-attachment.h"
#define GNOME_EVOLUTION_COMPOSER_OAFIID "OAFIID:GNOME_Evolution_Mail_Composer:" BASE_VERSION
@@ -823,9 +824,64 @@ comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *clien
return clone;
}
+static gboolean
+append_cal_attachments (GNOME_Evolution_Composer composer_server, ECalComponent
+ *comp, GSList *attach_list)
+{
+ CORBA_char *content_type = NULL, *filename = NULL, *description = NULL;
+ CORBA_Environment ev;
+ GNOME_Evolution_Composer_AttachmentData *attach_data = NULL;
+ struct CalMimeAttach *mime_attach;
+ GSList *l;
+ gboolean retval = TRUE;
+
+ CORBA_exception_init (&ev);
+
+ for (l = attach_list; l ; l = l->next) {
+ mime_attach = (struct CalMimeAttach *) l->data;
+
+ filename = CORBA_string_dup (mime_attach->filename);
+ content_type = CORBA_string_dup (mime_attach->content_type);
+ description = CORBA_string_dup (mime_attach->description);
+
+ attach_data = GNOME_Evolution_Composer_AttachmentData__alloc ();
+ attach_data->_length = mime_attach->length;
+ attach_data->_maximum = attach_data->_length;
+ attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length);
+ memcpy (attach_data->_buffer, mime_attach->encoded_data, attach_data->_length);
+
+ GNOME_Evolution_Composer_attachData (composer_server,
+ content_type, filename, description,
+ TRUE, attach_data,
+ &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Unable to add attachments in composer");
+ retval = FALSE;
+ }
+
+ CORBA_exception_free (&ev);
+ if (content_type != NULL)
+ CORBA_free (content_type);
+ if (filename != NULL)
+ CORBA_free (filename);
+ if (description != NULL)
+ CORBA_free (description);
+ if (attach_data != NULL) {
+ CORBA_free (attach_data->_buffer);
+ CORBA_free (attach_data);
+ }
+ g_free (mime_attach->filename);
+ g_free (mime_attach->content_type);
+ g_free (mime_attach->description);
+ g_free (mime_attach->encoded_data);
+ }
+
+ return retval;
+}
+
gboolean
itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
- ECal *client, icalcomponent *zones)
+ ECal *client, icalcomponent *zones, GSList *attachments_list)
{
GNOME_Evolution_Composer composer_server;
ECalComponent *comp = NULL;
@@ -932,7 +988,12 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
g_warning ("Unable to place iTip message in composer");
goto cleanup;
}
-
+
+ if (attachments_list) {
+ if (append_cal_attachments (composer_server, comp, attachments_list))
+ retval = TRUE;
+ }
+
if (method == E_CAL_COMPONENT_METHOD_PUBLISH) {
GNOME_Evolution_Composer_show (composer_server, &ev);
if (BONOBO_EX (&ev))