From 8c22a4d62ecd7f626aad583192e361e3658c72ee Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Wed, 29 Aug 2001 21:21:22 +0000 Subject: Pass in FALSE as the 'sending' arg to e_msg_composer_get_message. 2001-08-29 Jon Trowbridge * e-msg-composer.c (e_msg_composer_get_message_draft): Pass in FALSE as the 'sending' arg to e_msg_composer_get_message. (build_message): Added a 'sending' arg, which is passed to e_msg_composer_get_message. (e_msg_composer_get_message): Added a 'sending' arg, which gets passed directly on to build_message. * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_message): Added a "sending" arg, which should be TRUE if the message is being sent now (rather than being autosaved, etc.). The address use scores are only updated when sending. (Bug #8332) Removed obsolete (#if 0/#endif-ed) code. 2001-08-29 Jon Trowbridge * mail-callbacks.c (composer_get_message): When calling e_msg_composer_get_message, pass in TRUE for the 'sending' arg. (Part of the fix for bug #8332) svn path=/trunk/; revision=12518 --- composer/ChangeLog | 15 ++++++++++ composer/e-msg-composer-hdrs.c | 66 +++++++----------------------------------- composer/e-msg-composer-hdrs.h | 3 +- composer/e-msg-composer.c | 10 +++---- composer/e-msg-composer.h | 3 +- 5 files changed, 34 insertions(+), 63 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 338e70d738..6ed27c9dbd 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,18 @@ +2001-08-29 Jon Trowbridge + + * e-msg-composer.c (e_msg_composer_get_message_draft): Pass + in FALSE as the 'sending' arg to e_msg_composer_get_message. + (build_message): Added a 'sending' arg, which is passed to + e_msg_composer_get_message. + (e_msg_composer_get_message): Added a 'sending' arg, + which gets passed directly on to build_message. + + * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_message): Added + a "sending" arg, which should be TRUE if the message is being + sent now (rather than being autosaved, etc.). The address + use scores are only updated when sending. (Bug #8332) + Removed obsolete (#if 0/#endif-ed) code. + 2001-08-22 Jon Trowbridge * e-msg-composer-hdrs.c (set_recipients_from_destv): Added. Try diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 58e70f32f5..9e588ec18e 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -716,65 +716,24 @@ set_recipients_from_destv (CamelMimeMessage *msg, } static void -touch_and_free_destv (EDestination **destv) +free_destv (EDestination **destv, gboolean should_we_touch) { gint i; if (destv) { for (i = 0; destv[i] != NULL; ++i) { - e_destination_touch (destv[i]); + if (should_we_touch) + e_destination_touch (destv[i]); gtk_object_unref (GTK_OBJECT (destv[i])); } g_free (destv); } } - - -#if 0 - -static void -set_recipients (CamelMimeMessage *msg, GtkWidget *entry_widget, const gchar *type) -{ - EDestination **destv; - CamelInternetAddress *addr; - char *string = NULL, *dest_str = NULL; - int i; - - bonobo_widget_get_property (BONOBO_WIDGET (entry_widget), "destinations", &string, NULL); - destv = e_destination_importv (string); - - if (destv) { - dest_str = e_destination_get_address_textv (destv); - - g_message ("dest_str=[%s]", dest_str); - - /* dest_str has been utf8 encoded 2x by this point...not good */ - - if (dest_str && *dest_str) { - addr = camel_internet_address_new (); - camel_address_unformat (CAMEL_ADDRESS (addr), dest_str); - - camel_mime_message_set_recipients (msg, type, addr); - - camel_object_unref (CAMEL_OBJECT (addr)); - - g_free (dest_str); - } - - for (i = 0; destv[i]; i++) { - e_destination_touch (destv[i]); - gtk_object_unref (GTK_OBJECT (destv[i])); - } - g_free (destv); - } - - g_free (string); -} -#endif void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, - CamelMimeMessage *msg) + CamelMimeMessage *msg, + gboolean sending) { CamelInternetAddress *addr; gchar *subject; @@ -794,7 +753,7 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, camel_mime_message_set_from (msg, addr); camel_object_unref (CAMEL_OBJECT (addr)); - addr = e_msg_composer_hdrs_get_reply_to (hdrs); + addr = e_msg_composer_hdrs_get_reply_to (hdrs); if (addr) { camel_mime_message_set_reply_to (msg, addr); camel_object_unref (CAMEL_OBJECT (addr)); @@ -821,15 +780,10 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv); - touch_and_free_destv (to_destv); - touch_and_free_destv (cc_destv); - touch_and_free_destv (bcc_destv); - -#if 0 - set_recipients (msg, hdrs->priv->to.entry, CAMEL_RECIPIENT_TYPE_TO); - set_recipients (msg, hdrs->priv->cc.entry, CAMEL_RECIPIENT_TYPE_CC); - set_recipients (msg, hdrs->priv->bcc.entry, CAMEL_RECIPIENT_TYPE_BCC); -#endif + /* Only touch the destinations (boosting the use score) if we are sending */ + free_destv (to_destv, sending); + free_destv (cc_destv, sending); + free_destv (bcc_destv, sending); } diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h index 42f8dee7d1..b3a968920b 100644 --- a/composer/e-msg-composer-hdrs.h +++ b/composer/e-msg-composer-hdrs.h @@ -79,7 +79,8 @@ GtkType e_msg_composer_hdrs_get_type (void); GtkWidget *e_msg_composer_hdrs_new (gint visible_flags); void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, - CamelMimeMessage *msg); + CamelMimeMessage *msg, + gboolean sending); void e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, const char *account_name); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index a0a5c1d6d8..5dcaf73400 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -289,7 +289,7 @@ add_inlined_images (EMsgComposer *composer, CamelMultipart *multipart) * composed in `composer'. */ static CamelMimeMessage * -build_message (EMsgComposer *composer) +build_message (EMsgComposer *composer, gboolean sending) { EMsgComposerAttachmentBar *attachment_bar = E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar); @@ -310,7 +310,7 @@ build_message (EMsgComposer *composer) return NULL; new = camel_mime_message_new (); - e_msg_composer_hdrs_to_message (hdrs, new); + e_msg_composer_hdrs_to_message (hdrs, new, sending); for (i = 0; i < composer->extra_hdr_names->len; i++) { camel_medium_add_header (CAMEL_MEDIUM (new), composer->extra_hdr_names->pdata[i], @@ -3007,12 +3007,12 @@ e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment) * Return value: A pointer to the new CamelMimeMessage object **/ CamelMimeMessage * -e_msg_composer_get_message (EMsgComposer *composer) +e_msg_composer_get_message (EMsgComposer *composer, gboolean sending) { g_return_val_if_fail (composer != NULL, NULL); g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); - return build_message (composer); + return build_message (composer, sending); } CamelMimeMessage * @@ -3038,7 +3038,7 @@ e_msg_composer_get_message_draft (EMsgComposer *composer) old_smime_encrypt = composer->smime_encrypt; composer->smime_encrypt = FALSE; - msg = e_msg_composer_get_message (composer); + msg = e_msg_composer_get_message (composer, FALSE); composer->send_html = old_send_html; composer->pgp_sign = old_pgp_sign; diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 11ab45cdd8..c76d54450b 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -124,7 +124,8 @@ void e_msg_composer_add_header (EMsgComposer *compose const char *value); void e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment); -CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer); +CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer, + gboolean sending); CamelMimeMessage *e_msg_composer_get_message_draft (EMsgComposer *composer); void e_msg_composer_show_sig_file (EMsgComposer *composer); gboolean e_msg_composer_get_send_html (EMsgComposer *composer); -- cgit v1.2.3