aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@novell.com>2005-01-15 00:20:53 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2005-01-15 00:20:53 +0800
commit00d0c032c22d74dc025cf9a01f4e687dfaf32f63 (patch)
tree4eaa0a96f0b218c43cb52dd6c718487f6213bb50
parent1e45daf6f66eaf5182290781e18271ac6e9f41ba (diff)
downloadgsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.tar
gsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.tar.gz
gsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.tar.bz2
gsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.tar.lz
gsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.tar.xz
gsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.tar.zst
gsoc2013-evolution-00d0c032c22d74dc025cf9a01f4e687dfaf32f63.zip
new function to correctly retrieve the body of the message.
2005-01-14 Rodrigo Moya <rodrigo@novell.com> * mail-to-task.c (set_description): new function to correctly retrieve the body of the message. (do_mail_to_task): call set_description. svn path=/trunk/; revision=28406
-rw-r--r--plugins/mail-to-task/ChangeLog6
-rw-r--r--plugins/mail-to-task/mail-to-task.c58
2 files changed, 46 insertions, 18 deletions
diff --git a/plugins/mail-to-task/ChangeLog b/plugins/mail-to-task/ChangeLog
index 3cac365fb5..ffe03944a7 100644
--- a/plugins/mail-to-task/ChangeLog
+++ b/plugins/mail-to-task/ChangeLog
@@ -1,3 +1,9 @@
+2005-01-14 Rodrigo Moya <rodrigo@novell.com>
+
+ * mail-to-task.c (set_description): new function to correctly
+ retrieve the body of the message.
+ (do_mail_to_task): call set_description.
+
2004-11-04 Rodrigo Moya <rodrigo@novell.com>
* org-gnome-mail-to-task.eplug.in: fixed description and added
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 595d64d974..d2c5f9eb71 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -1,11 +1,11 @@
-/* Copyright (C) 2004 Michael Zucchi */
+/* Copyright (C) 2004 Novell, Inc */
+/* Authors: Michael Zucchi
+ Rodrigo Moya */
/* This file is licensed under the GNU GPL v2 or later */
-/* Add 'copy to clipboard' things to various menu's.
-
- Uh, so far only to copy mail addresses from mail content */
+/* Convert a mail message into a task */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -18,8 +18,11 @@
#include <gconf/gconf-client.h>
#include <libecal/e-cal.h>
#include <libedataserverui/e-source-selector-dialog.h>
-#include "camel/camel-folder.h"
-#include "camel/camel-mime-message.h"
+#include <camel/camel-folder.h>
+#include <camel/camel-medium.h>
+#include <camel/camel-mime-message.h>
+#include <camel/camel-stream.h>
+#include <camel/camel-stream-mem.h>
#include "mail/em-popup.h"
static void
@@ -54,6 +57,35 @@ set_attendees (ECalComponent *comp, CamelMimeMessage *message)
}
static void
+set_description (ECalComponent *comp, CamelMimeMessage *message)
+{
+ CamelDataWrapper *content;
+ CamelStream *mem;
+ ECalComponentText text;
+ GSList sl;
+ char *str;
+
+ content = camel_medium_get_content_object ((CamelMedium *) message);
+ if (!content)
+ return;
+
+ mem = camel_stream_mem_new ();
+ camel_data_wrapper_decode_to_stream (content, mem);
+
+ str = g_strndup (((CamelStreamMem *) mem)->buffer->data, ((CamelStreamMem *) mem)->buffer->len);
+ camel_object_unref (mem);
+
+ text.value = str;
+ text.altrep = NULL;
+ sl.next = NULL;
+ sl.data = &text;
+
+ e_cal_component_set_description_list (comp, &sl);
+
+ g_free (str);
+}
+
+static void
set_organizer (ECalComponent *comp, CamelMimeMessage *message)
{
const CamelInternetAddress *address;
@@ -89,8 +121,6 @@ do_mail_to_task (EMPopupTargetSelect *t, ESource *tasks_source)
CamelMimeMessage *message;
ECalComponent *comp;
ECalComponentText text;
- GSList sl;
- char *str;
/* retrieve the message from the CamelFolder */
message = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, i), NULL);
@@ -106,16 +136,8 @@ do_mail_to_task (EMPopupTargetSelect *t, ESource *tasks_source)
text.altrep = NULL;
e_cal_component_set_summary (comp, &text);
- /* FIXME: a better way to get the full body */
- str = camel_mime_message_build_mbox_from (message);
- text.value = str;
- sl.next = NULL;
- sl.data = &text;
- e_cal_component_set_description_list (comp, &sl);
-
- g_free (str);
-
- /* set the organizer, and the attendees */
+ /* set all fields */
+ set_description (comp, message);
set_organizer (comp, message);
set_attendees (comp, message);