aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-08-30 02:44:47 +0800
committerDan Winship <danw@src.gnome.org>2000-08-30 02:44:47 +0800
commitba2eaa68b17882b0fec2eac160f674d29598795f (patch)
treef97a4baff35c94b5263ac9b8c1a38f7219172b0b
parentec4ed21ea96f66ccd4b2c29f4f14046f8ece8a56 (diff)
downloadgsoc2013-evolution-ba2eaa68b17882b0fec2eac160f674d29598795f.tar.gz
gsoc2013-evolution-ba2eaa68b17882b0fec2eac160f674d29598795f.tar.zst
gsoc2013-evolution-ba2eaa68b17882b0fec2eac160f674d29598795f.zip
Update this and related functions to no longer take a From address. (The
* mail-ops.c (mail_do_send_mail): Update this and related functions to no longer take a From address. (The composer deals with it itself now.) (do_send_mail): Add the Evolution version back to the X-Mailer header (this change got lost in the thread migration). * mail-callbacks.c (composer_send_cb): Don't re-fetch the From address. It's set by the composer now. Don't free the post_send_data from here. (mail_reply): Attach to the composer's destroy signal to free the psd. (The current code would free it more than once if an error occurred while trying to send the first time.) svn path=/trunk/; revision=5102
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/mail-callbacks.c32
-rw-r--r--mail/mail-ops.c18
-rw-r--r--mail/mail-ops.h2
4 files changed, 26 insertions, 41 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 105bcc46e6..e5c84919b8 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2000-08-29 Dan Winship <danw@helixcode.com>
+
+ * mail-ops.c (mail_do_send_mail): Update this and related
+ functions to no longer take a From address. (The composer deals
+ with it itself now.)
+ (do_send_mail): Add the Evolution version back to the X-Mailer
+ header (this change got lost in the thread migration).
+
+ * mail-callbacks.c (composer_send_cb): Don't re-fetch the From
+ address. It's set by the composer now. Don't free the
+ post_send_data from here.
+ (mail_reply): Attach to the composer's destroy signal to free the
+ psd. (The current code would free it more than once if an error
+ occurred while trying to send the first time.)
+
2000-08-28 Peter Williams <peterw@helixcode.com>
* mail-config-gui.c (mail_config_apply_clicked): Add new news sources,
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index f67557022b..970221eadf 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -195,10 +195,9 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
}
static void
-free_psd (struct post_send_data *psd)
+free_psd (GtkWidget *composer, gpointer user_data)
{
- if (!psd)
- return;
+ struct post_send_data *psd = user_data;
if (psd->folder)
camel_object_unref (CAMEL_OBJECT (psd->folder));
@@ -210,29 +209,14 @@ free_psd (struct post_send_data *psd)
void
composer_send_cb (EMsgComposer *composer, gpointer data)
{
- gchar *from = NULL;
- const MailConfigIdentity *id = NULL;
MailConfigService *xport = NULL;
CamelMimeMessage *message;
const char *subject;
struct post_send_data *psd = data;
/* Config info */
- id = mail_config_get_default_identity ();
xport = mail_config_get_transport ();
- /* Generate our from address */
- /* FIXME: we shouldn't need this code anymore as it's taken care of in the composer */
- from = e_msg_composer_hdrs_get_from (E_MSG_COMPOSER_HDRS (composer->hdrs));
- if (!from) {
- CamelInternetAddress *ciaddr;
-
- ciaddr = camel_internet_address_new ();
- camel_internet_address_add (ciaddr, id->name, id->address);
- from = camel_address_encode (CAMEL_ADDRESS (ciaddr));
- camel_object_unref (CAMEL_OBJECT (ciaddr));
- }
-
/* Get the message */
message = e_msg_composer_get_message (composer);
@@ -241,24 +225,18 @@ 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));
- free_psd (psd); /* will take care of psd == NULL */
return;
}
}
if (psd) {
- mail_do_send_mail (xport->url, message, from,
+ mail_do_send_mail (xport->url, message,
psd->folder, psd->uid, psd->flags,
GTK_WIDGET (composer));
} else {
- mail_do_send_mail (xport->url, message, from,
- NULL, NULL, 0,
+ mail_do_send_mail (xport->url, message, NULL, NULL, 0,
GTK_WIDGET (composer));
}
-
- g_free (from);
-
- free_psd (psd);
}
static GtkWidget *
@@ -341,6 +319,8 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolea
gtk_signal_connect (GTK_OBJECT (composer), "send",
GTK_SIGNAL_FUNC (composer_send_cb), psd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (free_psd), psd);
gtk_widget_show (GTK_WIDGET (composer));
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 847019ecd4..d7bfb9af10 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -206,7 +206,6 @@ typedef struct send_mail_input_s
{
gchar *xport_uri;
CamelMimeMessage *message;
- gchar *from;
/* If done_folder != NULL, will add done_flags to
* the flags of the message done_uid in done_folder. */
@@ -268,12 +267,6 @@ setup_send_mail (gpointer in_data, gpointer op_data, CamelException *ex)
return;
}
- if (input->from == NULL) {
- camel_exception_set (ex, CAMEL_EXCEPTION_INVALID_PARAM,
- "No from address specified for send_mail operation.");
- return;
- }
-
/* NOTE THE EARLY EXIT!! */
if (input->done_folder == NULL) {
@@ -312,12 +305,14 @@ do_send_mail (gpointer in_data, gpointer op_data, CamelException *ex)
{
send_mail_input_t *input = (send_mail_input_t *) in_data;
CamelTransport *xport;
+ char *x_mailer;
mail_tool_camel_lock_up ();
- camel_mime_message_set_from (input->message, input->from);
-
+ x_mailer = g_strdup_printf ("Evolution %s (Developer Preview)",
+ VERSION);
camel_medium_add_header (CAMEL_MEDIUM (input->message), "X-Mailer",
- "Evolution (Developer Preview)");
+ x_mailer);
+ g_free (x_mailer);
camel_mime_message_set_date (input->message,
CAMEL_MESSAGE_DATE_CURRENT, 0);
@@ -355,7 +350,6 @@ cleanup_send_mail (gpointer in_data, gpointer op_data, CamelException *ex)
if (input->done_folder)
camel_object_unref (CAMEL_OBJECT (input->done_folder));
- g_free (input->from);
g_free (input->xport_uri);
g_free (input->done_uid);
@@ -376,7 +370,6 @@ static const mail_operation_spec op_send_mail = {
void
mail_do_send_mail (const char *xport_uri,
CamelMimeMessage *message,
- const char *from,
CamelFolder *done_folder,
const char *done_uid,
guint32 done_flags, GtkWidget *composer)
@@ -386,7 +379,6 @@ mail_do_send_mail (const char *xport_uri,
input = g_new (send_mail_input_t, 1);
input->xport_uri = g_strdup (xport_uri);
input->message = message;
- input->from = g_strdup (from);
input->done_folder = done_folder;
input->done_uid = g_strdup (done_uid);
input->done_flags = done_flags;
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index bcd2d1e2bc..33f7456f82 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -33,10 +33,8 @@ void mail_do_fetch_mail (const gchar *source_url, gboolean keep_on_server,
gpointer hook_func, gpointer hook_data);
void mail_do_send_mail (const char *xport_uri,
CamelMimeMessage *message,
- const char *from,
CamelFolder *done_folder,
const char *done_uid,
-
guint32 done_flags, GtkWidget *composer);
void mail_do_expunge_folder (CamelFolder *folder);
void mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids,