aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-04-24 01:15:07 +0800
committerDan Winship <danw@src.gnome.org>2000-04-24 01:15:07 +0800
commit4c1c537e19a6397fc4b3418e5db6eea4239ab741 (patch)
tree3402e5a878062bb5e81970729c9acc94013bc1eb /mail/mail-format.c
parentb33db409a60f49c61d035f7d3cc2e1232ec8a186 (diff)
downloadgsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar
gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.gz
gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.bz2
gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.lz
gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.xz
gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.tar.zst
gsoc2013-evolution-4c1c537e19a6397fc4b3418e5db6eea4239ab741.zip
rename "send" to "send_msg", to avoid name clash with the tcp function.
* folder-browser-factory.c: rename "send" to "send_msg", to avoid name clash with the tcp function. Connect the "forward" button. * mail-ops.c: rename "send" to "send_msg", to avoid name clash with the tcp function. Add forward_msg function. * mail-format.c (mail_generate_forward): support function for forward_msg. Pretty much a big kludge right now, pending the attachment/attachment-bar changes. svn path=/trunk/; revision=2562
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 5fdf3b2d79..b5aba4ca32 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1060,3 +1060,59 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
return composer;
}
+
+/* This is part of the temporary kludge below. */
+#ifndef HAVE_MKSTEMP
+#include <fcntl.h>
+#include <sys/stat.h>
+#endif
+
+EMsgComposer *
+mail_generate_forward (CamelMimeMessage *mime_message,
+ gboolean forward_as_attachment,
+ gboolean keep_attachments)
+{
+ EMsgComposer *composer;
+ char *tmpfile;
+ int fd;
+ CamelStream *stream;
+
+ if (!forward_as_attachment)
+ g_warning ("Forward as non-attachment not implemented.");
+ if (!keep_attachments)
+ g_warning ("Forwarding without attachments not implemented.");
+
+ /* For now, we kludge by writing out a temp file. Later,
+ * EMsgComposer will support attaching CamelMimeParts directly,
+ * or something. FIXME.
+ */
+ tmpfile = g_strdup ("/tmp/evolution-kludge-XXXX");
+#ifdef HAVE_MKSTEMP
+ fd = mkstemp (tmpfile);
+#else
+ if (mktemp (tmpfile)) {
+ fd = open (tmpfile, O_RDWR | O_CREAT | O_EXCL,
+ S_IRUSR | S_IWUSR);
+ } else
+ fd = -1;
+#endif
+ if (fd == -1) {
+ g_warning ("Couldn't create temp file for forwarding");
+ g_free (tmpfile);
+ return NULL;
+ }
+
+ stream = camel_stream_fs_new_with_fd (fd);
+ camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message),
+ stream);
+ camel_stream_close (stream);
+
+ composer = E_MSG_COMPOSER (e_msg_composer_new ());
+ e_msg_composer_attachment_bar_attach (composer->attachment_bar,
+ tmpfile);
+ g_free (tmpfile);
+
+ /* FIXME: should we default a subject? */
+
+ return composer;
+}