From 397a851038f09c2a40ac70f8dbf04308622c2c02 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 27 Apr 2000 19:03:54 +0000 Subject: Move text_to_html to e-util. * mail-format.c: Move text_to_html to e-util. * mail-ops.c (send_to_url): New routine. Thin wrapper for e_msg_composer_new_from_url. * mail-display.c (on_link_clicked): print a warning for news or nntp URLs (which we'll deal with some day), and call send_to_url for mailto URLs. svn path=/trunk/; revision=2664 --- mail/mail-ops.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'mail/mail-ops.c') diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 81724c4f43..b339bfd746 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -258,16 +258,32 @@ static void composer_send_cb (EMsgComposer *composer, gpointer data) { CamelMimeMessage *message; - CamelStream *stream; - int stdout_dup; + CamelTransport *transport; + CamelException *ex; + static gboolean loaded = FALSE; message = e_msg_composer_get_message (composer); - - stdout_dup = dup (1); - stream = camel_stream_fs_new_with_fd (stdout_dup); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), - stream); - camel_stream_close (stream); + camel_mime_message_set_from (message, + "Dan Winship "); + camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer", + "Evolution 0.0.0.0.0.0.0.0.0.1"); + camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0); + + if (!loaded) { + camel_provider_register_as_module ("/usr/local/lib/evolution/camel-providers/0.0.1/libcamelsendmail.so"); + loaded = TRUE; + } + ex = camel_exception_new (); + transport = camel_session_get_transport_for_protocol ( + default_session->session, "sendmail", ex); + if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) + g_warning (camel_exception_get_description (ex)); + else { + camel_transport_send (transport, CAMEL_MEDIUM (message), ex); + if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) + g_warning (camel_exception_get_description (ex)); + gtk_object_destroy (GTK_OBJECT (transport)); + } gtk_object_unref (GTK_OBJECT (message)); gtk_object_destroy (GTK_OBJECT (composer)); @@ -286,6 +302,18 @@ send_msg (GtkWidget *widget, gpointer user_data) gtk_widget_show (composer); } +/* Send according to a mailto (RFC 2368) URL. */ +void +send_to_url (const char *url) +{ + GtkWidget *composer; + + composer = e_msg_composer_new_from_url (url); + + gtk_signal_connect (GTK_OBJECT (composer), "send", + GTK_SIGNAL_FUNC (composer_send_cb), NULL); + gtk_widget_show (composer); +} static void reply (FolderBrowser *fb, gboolean to_all) -- cgit