aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-29 01:48:07 +0800
committerDan Winship <danw@src.gnome.org>2001-03-29 01:48:07 +0800
commitb38a35a5187475b13210474cea7140025793b502 (patch)
tree3508123310f89e26c0d4f93e6d764fd6ccf7a6ac /mail/mail-callbacks.c
parent34ea3020395002ea43ddad071db305b4a35c51cc (diff)
downloadgsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.gz
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.bz2
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.lz
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.xz
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.zst
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.zip
Set up the sent/drafts folder buttons. (folder_picker_clicked): Pop up the
* mail-account-gui.c (mail_account_gui_new): Set up the sent/drafts folder buttons. (folder_picker_clicked): Pop up the folder selector when sent or drafts is clicked. (mail_account_gui_save): Save the sent/drafts folders. * mail-config.c (account_copy): copy sent/drafts info (config_read): read sent/drafts info (mail_config_write): write sent/drafts info * mail-callbacks.c (composer_send_cb, composer_postpone_cb): split out some common code here (and fix inconsistencies). Always set headers on the message giving the account name, transport, and sent folder to use. * mail-ops.c (mail_send_message): If the message has an X-Evolution-Account header, use the transport/sent folder info for that account (assuming it still exists). Otherwise, if it has X-Evolution-Transport and/or X-Evolution-Fcc, use those. If not, use the default transport and sent folder. FIXME: Falls back silently to the default sent folder if it can't open the account-specific one... (send_queue_send): remove the X-Evolution-Transport, etc processing here, as it gets done by mail_send_message now. FIXME: We only sync the default sent folder. * component-factory.c (owner_set_cb): While setting up the standard folders, also record their URIs. svn path=/trunk/; revision=8991
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c93
1 files changed, 45 insertions, 48 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index eb612da9db..1e453b98ea 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -280,35 +280,17 @@ composer_sent_cb(char *uri, CamelMimeMessage *message, gboolean sent, void *data
camel_object_unref (CAMEL_OBJECT (message));
}
-void
-composer_send_cb (EMsgComposer *composer, gpointer data)
+CamelMimeMessage *
+composer_get_message (EMsgComposer *composer)
{
- const MailConfigAccount *account = NULL;
CamelMimeMessage *message;
const CamelInternetAddress *iaddr;
const char *subject;
- struct post_send_data *psd = data;
- struct _send_data *send;
-
- if (!mail_config_is_configured ()) {
- GtkWidget *dialog;
-
- dialog = gnome_ok_dialog_parented (_("You must configure an account before you "
- "can send this email."),
- GTK_WINDOW (composer));
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
- return;
- }
-
- /* Use the preferred account */
- account = e_msg_composer_get_preferred_account (composer);
- if (!account)
- account = mail_config_get_default_account ();
+ const MailConfigAccount *account;
- /* Get the message */
message = e_msg_composer_get_message (composer);
if (message == NULL)
- return;
+ return NULL;
/* Check for no recipients */
iaddr = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
@@ -324,7 +306,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
camel_object_unref (CAMEL_OBJECT (message));
- return;
+ return NULL;
}
/* Check for no subject */
@@ -332,55 +314,70 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
if (subject == NULL || subject[0] == '\0') {
if (!ask_confirm_for_empty_subject (composer)) {
camel_object_unref (CAMEL_OBJECT (message));
- return;
+ return NULL;
}
}
+
+ /* Add info about the sending account */
+ account = e_msg_composer_get_preferred_account (composer);
+ if (account) {
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
+ }
+
+ return message;
+}
+
+void
+composer_send_cb (EMsgComposer *composer, gpointer data)
+{
+ const MailConfigService *transport;
+ CamelMimeMessage *message;
+ struct post_send_data *psd = data;
+ struct _send_data *send;
+ if (!mail_config_is_configured ()) {
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_dialog_parented (_("You must configure an account before you "
+ "can send this email."),
+ GTK_WINDOW (composer));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ return;
+ }
+
+ message = composer_get_message (composer);
+ if (!message)
+ return;
+ transport = mail_config_get_default_transport ();
+
send = g_malloc (sizeof (*send));
send->psd = psd;
send->composer = composer;
gtk_object_ref (GTK_OBJECT (composer));
gtk_widget_hide (GTK_WIDGET (composer));
- mail_send_mail (account->transport->url, message, composer_sent_cb, send);
+ mail_send_mail (transport->url, message, composer_sent_cb, send);
}
void
composer_postpone_cb (EMsgComposer *composer, gpointer data)
{
- const MailConfigAccount *account = NULL;
extern CamelFolder *outbox_folder;
CamelMimeMessage *message;
struct post_send_data *psd = data;
- const char *subject;
- /* Get the message */
- message = e_msg_composer_get_message (composer);
+ message = composer_get_message (composer);
if (message == NULL)
return;
- /* Check for no subject */
- subject = camel_mime_message_get_subject (message);
- if (subject == NULL || subject[0] == '\0') {
- if (!ask_confirm_for_empty_subject (composer)) {
- camel_object_unref (CAMEL_OBJECT (message));
- return;
- }
- }
-
- /* Attach a X-Evolution-Transport header so we know which account
- to use when it gets sent later. */
- account = e_msg_composer_get_preferred_account (composer);
- if (!account)
- account = mail_config_get_default_account ();
- camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
-
- /* Save the message in Outbox */
mail_append_mail (outbox_folder, message, NULL, NULL, NULL);
-
camel_object_unref (CAMEL_OBJECT (message));
- if (psd)
+ if (psd) {
camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->flags);
+ free_psd (NULL, psd);
+ }
gtk_widget_destroy (GTK_WIDGET (composer));
}