aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-ops.c28
2 files changed, 35 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 4d647f134d..68e119b7e2 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2000-06-19 Ettore Perazzoli <ettore@helixcode.com>
+
+ * mail-ops.c (ask_confirm_for_empty_subject): New function to ask
+ confirmation for an empty subject line.
+ (composer_send_cb): Use it if the subject is empty and only send
+ the message if the user confirms.
+
2000-06-20 Jeffrey Stedfast <fejj@helixcode.com>
* component-factory.c (create_imap_storage): Now creates the IMAP
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index c28c4a0de6..6f27acefd4 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -276,12 +276,32 @@ struct post_send_data {
guint32 flags;
};
+static gboolean
+ask_confirm_for_empty_subject (EMsgComposer *composer)
+{
+ GtkWidget *message_box;
+ int button;
+
+ message_box = gnome_message_box_new (_("This message has no subject.\nReally send?"),
+ GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
+
+ if (button == 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
static void
composer_send_cb (EMsgComposer *composer, gpointer data)
{
static CamelTransport *transport = NULL;
struct post_send_data *psd = data;
static char *from = NULL;
+ const char *subject;
CamelException *ex;
CamelMimeMessage *message;
char *name, *addr, *path;
@@ -328,6 +348,14 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
message = e_msg_composer_get_message (composer);
+ subject = camel_mime_message_get_subject (message);
+ if (subject == NULL || subject[0] == '\0') {
+ if (! ask_confirm_for_empty_subject (composer)) {
+ gtk_object_unref (GTK_OBJECT (message));
+ return;
+ }
+ }
+
camel_mime_message_set_from (message, from);
camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer",
"Evolution (Developer Preview)");