From 86d9e4453e88e3fa5f72c2c06da81aef272ed7aa Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 29 Jun 2001 20:20:21 +0000 Subject: Throw up the confirmation dialog. (composer_get_message): If the user only 2001-06-29 Jeffrey Stedfast * mail-callbacks.c (ask_confirm_for_only_bcc): Throw up the confirmation dialog. (composer_get_message): If the user only specified Bcc recipients, prompt him/her to make sure we should continue and risk the server adding an Apparently-To header. * mail-config.c (config_read): Read in config option for prompting when only Bcc recipients are specified. (mail_config_write_on_exit): Save the option. (mail_config_get_prompt_only_bcc): New. (mail_config_set_prompt_only_bcc): New. svn path=/trunk/; revision=10606 --- mail/mail-callbacks.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'mail/mail-callbacks.c') diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 209ff16320..0bc2898d27 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -207,7 +207,7 @@ send_receive_mail (GtkWidget *widget, gpointer user_data) } static void -empty_subject_destroyed (GtkWidget *widget, gpointer data) +msgbox_destroyed (GtkWidget *widget, gpointer data) { gboolean *show_again = data; GtkWidget *checkbox; @@ -239,7 +239,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer) NULL); gtk_signal_connect (GTK_OBJECT (mbox), "destroy", - empty_subject_destroyed, &show_again); + msgbox_destroyed, &show_again); button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox)); @@ -251,6 +251,43 @@ ask_confirm_for_empty_subject (EMsgComposer *composer) return FALSE; } +static gboolean +ask_confirm_for_only_bcc (EMsgComposer *composer) +{ + /* FIXME: EMessageBox should really handle this stuff + automagically. What Miguel thinks would be nice is to pass + in a message-id which could be used as a key in the config + file and the value would be an int. -1 for always show or + the button pressed otherwise. This probably means we'd have + to write e_messagebox_run () */ + gboolean show_again = TRUE; + GtkWidget *mbox; + int button; + + if (!mail_config_get_prompt_only_bcc ()) + return TRUE; + + mbox = e_message_box_new (_("This message contains only Bcc recipients.\nIt is " + "possible that the mail server may reveal the recipients " + "by adding an Apparently-To header.\nSend anyway?"), + E_MESSAGE_BOX_QUESTION, + GNOME_STOCK_BUTTON_YES, + GNOME_STOCK_BUTTON_NO, + NULL); + + gtk_signal_connect (GTK_OBJECT (mbox), "destroy", + msgbox_destroyed, &show_again); + + button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox)); + + mail_config_set_prompt_only_bcc (show_again); + + if (button == 0) + return TRUE; + else + return FALSE; +} + static void free_psd (GtkWidget *composer, gpointer user_data) { @@ -312,6 +349,14 @@ composer_get_message (EMsgComposer *composer) num_addrs += iaddr ? camel_address_length (CAMEL_ADDRESS (iaddr)) : 0; } + if (num_addrs == camel_address_length (CAMEL_ADDRESS (iaddr))) { + /* this means that the only recipients are Bcc's */ + if (!ask_confirm_for_only_bcc (composer)) { + camel_object_unref (CAMEL_OBJECT (message)); + return NULL; + } + } + /* I'm sensing a lack of love, er, I mean recipients. */ if (num_addrs == 0) { GtkWidget *message_box; -- cgit