diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-08-23 10:58:14 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-08-23 10:58:14 +0800 |
commit | 6fba7d7077b165410cb9362597f074556093561c (patch) | |
tree | 18f6abed525857e76f75d6bebfb239e9e5860f27 /composer | |
parent | e27c0f7d1a89c33e7c81de58984c7fb043f102f6 (diff) | |
download | gsoc2013-evolution-6fba7d7077b165410cb9362597f074556093561c.tar.gz gsoc2013-evolution-6fba7d7077b165410cb9362597f074556093561c.tar.zst gsoc2013-evolution-6fba7d7077b165410cb9362597f074556093561c.zip |
In the GUI, the toggle is labelled "hide addresses", not "show addresses"
2001-08-22 Jon Trowbridge <trow@ximian.com>
* gui/contact-list-editor/e-contact-list-editor.c (extract_info):
In the GUI, the toggle is labelled "hide addresses", not "show
addresses" -- so we have to reverse the boolean value we read in.
(fill_in_info): Same bug as before: since the GUI reads "hide", we
have to initialize the toggle to '!show_addresses', not
'show_addresses'.
* backend/ebook/e-destination.c
(e_destination_list_show_addresses): Added.
(e_destination_xml_encode): Encode the value of
e_destination_list_show_addresses into the XML.
(e_destination_xml_decode): Read and store the "show_addresses"
flag.
2001-08-22 Jon Trowbridge <trow@ximian.com>
* e-msg-composer-hdrs.c (set_recipients_from_destv): Added. Try
to properly handle contact lists in which the addresses of the
list members should be hidden.
(e_msg_composer_hdrs_to_message): Changed to extract the
destination data from the entries and pass it along to
set_recipients_from_destv.
2001-08-22 Jon Trowbridge <trow@ximian.com>
* mail-callbacks.c (ask_confirm_for_only_bcc): Provide alternative
text for this dialog for the case when a message has only Bcc
recipients because of a hidden contact list's addresses being
moved from To/Cc to Bcc.
(composer_get_message): Try to detect when our message has only
Bcc recipients because of moving addresses around due to a hidden
contact list, and show the dialog with the revised wording in this
case.
svn path=/trunk/; revision=12414
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 9 | ||||
-rw-r--r-- | composer/e-msg-composer-hdrs.c | 135 |
2 files changed, 143 insertions, 1 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 9e795ab166..338e70d738 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,12 @@ +2001-08-22 Jon Trowbridge <trow@ximian.com> + + * e-msg-composer-hdrs.c (set_recipients_from_destv): Added. Try + to properly handle contact lists in which the addresses of the + list members should be hidden. + (e_msg_composer_hdrs_to_message): Changed to extract the + destination data from the entries and pass it along to + set_recipients_from_destv. + 2001-08-22 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (save): When reporting an error, use diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index f51e154dda..58e70f32f5 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -628,6 +628,109 @@ e_msg_composer_hdrs_new (gint visible_flags) return GTK_WIDGET (new); } +static void +set_recipients_from_destv (CamelMimeMessage *msg, + EDestination **to_destv, + EDestination **cc_destv, + EDestination **bcc_destv) +{ + CamelInternetAddress *to_addr; + CamelInternetAddress *cc_addr; + CamelInternetAddress *bcc_addr; + CamelInternetAddress *target; + const gchar *text_addr; + gint i; + gboolean seen_hidden_list = FALSE; + + to_addr = camel_internet_address_new (); + cc_addr = camel_internet_address_new (); + bcc_addr = camel_internet_address_new (); + + if (to_destv) { + for (i = 0; to_destv[i] != NULL; ++i) { + text_addr = e_destination_get_address (to_destv[i]); + + + if (text_addr && *text_addr) { + + target = to_addr; + if (e_destination_is_evolution_list (to_destv[i]) + && !e_destination_list_show_addresses (to_destv[i])) { + target = bcc_addr; + seen_hidden_list = TRUE; + } + + camel_address_unformat (CAMEL_ADDRESS (target), text_addr); + } + } + } + + if (cc_destv) { + for (i = 0; cc_destv[i] != NULL; ++i) { + text_addr = e_destination_get_address (cc_destv[i]); + if (text_addr && *text_addr) { + + target = cc_addr; + if (e_destination_is_evolution_list (cc_destv[i]) + && !e_destination_list_show_addresses (cc_destv[i])) { + target = bcc_addr; + seen_hidden_list = TRUE; + } + + camel_address_unformat (CAMEL_ADDRESS (target),text_addr); + } + } + } + + if (bcc_destv) { + for (i = 0; bcc_destv[i] != NULL; ++i) { + text_addr = e_destination_get_address (bcc_destv[i]); + if (text_addr && *text_addr) { + + camel_address_unformat (CAMEL_ADDRESS (bcc_addr), text_addr); + } + } + } + + if (camel_address_length (CAMEL_ADDRESS (to_addr)) > 0) { + camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_TO, to_addr); + } else if (seen_hidden_list) { + camel_medium_set_header (CAMEL_MEDIUM (msg), CAMEL_RECIPIENT_TYPE_TO, "Undisclosed-Recipient:;"); + } + + if (camel_address_length (CAMEL_ADDRESS (cc_addr)) > 0) { + camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_CC, cc_addr); + } + + if (camel_address_length (CAMEL_ADDRESS (bcc_addr)) > 0) { + camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_BCC, bcc_addr); + } + + g_message (" To: (%d) [%s]", camel_address_length (CAMEL_ADDRESS (to_addr)), camel_address_format (CAMEL_ADDRESS (to_addr))); + g_message (" Cc: (%d) [%s]", camel_address_length (CAMEL_ADDRESS (cc_addr)), camel_address_format (CAMEL_ADDRESS (cc_addr))); + g_message ("Bcc: (%d) [%s]", camel_address_length (CAMEL_ADDRESS (bcc_addr)), camel_address_format (CAMEL_ADDRESS (bcc_addr))); + + camel_object_unref (CAMEL_OBJECT (to_addr)); + camel_object_unref (CAMEL_OBJECT (cc_addr)); + camel_object_unref (CAMEL_OBJECT (bcc_addr)); +} + +static void +touch_and_free_destv (EDestination **destv) +{ + gint i; + + if (destv) { + for (i = 0; destv[i] != NULL; ++i) { + 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) @@ -667,6 +770,7 @@ set_recipients (CamelMimeMessage *msg, GtkWidget *entry_widget, const gchar *typ g_free (string); } +#endif void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, @@ -674,6 +778,8 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, { CamelInternetAddress *addr; gchar *subject; + gchar *str = NULL; + EDestination **to_destv, **cc_destv, **bcc_destv; g_return_if_fail (hdrs != NULL); g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); @@ -693,10 +799,37 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, camel_mime_message_set_reply_to (msg, addr); camel_object_unref (CAMEL_OBJECT (addr)); } - + + /* Get string of destinations from each entry. */ + + bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->to.entry), "destinations", &str, NULL); + g_message ("to str: %s", str); + to_destv = e_destination_importv (str); + g_free (str); + + bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", &str, NULL); + g_message ("cc str: %s", str); + cc_destv = e_destination_importv (str); + g_free (str); + + bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->bcc.entry), "destinations", &str, NULL); + g_message ("bcc str: %s", str); + bcc_destv = e_destination_importv (str); + g_free (str); + + /* Attach destinations to the message. */ + + 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 } |