aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-23 10:58:14 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-23 10:58:14 +0800
commit6fba7d7077b165410cb9362597f074556093561c (patch)
tree18f6abed525857e76f75d6bebfb239e9e5860f27
parente27c0f7d1a89c33e7c81de58984c7fb043f102f6 (diff)
downloadgsoc2013-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
-rw-r--r--addressbook/ChangeLog16
-rw-r--r--addressbook/backend/ebook/e-destination.c24
-rw-r--r--addressbook/backend/ebook/e-destination.h3
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c4
-rw-r--r--composer/ChangeLog9
-rw-r--r--composer/e-msg-composer-hdrs.c135
-rw-r--r--mail/ChangeLog26
-rw-r--r--mail/mail-callbacks.c44
8 files changed, 249 insertions, 12 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index eaa2782ce0..3b05766685 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,19 @@
+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 jacob berkman <jacob@ximian.com>
* gui/component/e-address-popup.c (emit_event): emit an event from
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 25e1caa6ec..076eccf835 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -67,6 +67,7 @@ struct _EDestinationPrivate {
gboolean wants_html_mail;
GList *list_dests;
+ gboolean show_addresses;
gboolean has_been_cardified;
gboolean allow_cardify;
@@ -750,6 +751,17 @@ e_destination_is_evolution_list (const EDestination *dest)
}
gboolean
+e_destination_list_show_addresses (const EDestination *dest)
+{
+ g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
+
+ if (dest->priv->card != NULL)
+ return e_card_evolution_list_show_addresses (dest->priv->card);
+
+ return dest->priv->show_addresses;
+}
+
+gboolean
e_destination_get_html_mail_pref (const EDestination *dest)
{
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
@@ -1031,6 +1043,8 @@ e_destination_xml_encode (const EDestination *dest)
}
xmlNewProp (dest_node, "is_list", "yes");
+ xmlNewProp (dest_node, "show_addresses",
+ e_destination_list_show_addresses (dest) ? "yes" : "no");
}
str = e_destination_get_book_uri (dest);
@@ -1057,7 +1071,7 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
gchar *name = NULL, *email = NULL, *book_uri = NULL, *card_uid = NULL;
gint email_num = -1;
gboolean html_mail = FALSE;
- gboolean is_list = FALSE;
+ gboolean is_list = FALSE, show_addr = FALSE;
gchar *tmp;
GList *list_dests = NULL;
@@ -1079,6 +1093,12 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
xmlFree (tmp);
}
+ tmp = xmlGetProp (node, "show_addresses");
+ if (tmp) {
+ show_addr = !strcmp (tmp, "yes");
+ xmlFree (tmp);
+ }
+
node = node->xmlChildrenNode;
while (node) {
if (!strcmp (node->name, "name")) {
@@ -1154,6 +1174,8 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
if (list_dests)
dest->priv->list_dests = list_dests;
+ dest->priv->show_addresses = show_addr;
+
e_destination_thaw (dest);
return TRUE;
diff --git a/addressbook/backend/ebook/e-destination.h b/addressbook/backend/ebook/e-destination.h
index dc43d9703c..c0ab60d33f 100644
--- a/addressbook/backend/ebook/e-destination.h
+++ b/addressbook/backend/ebook/e-destination.h
@@ -95,7 +95,8 @@ const gchar *e_destination_get_address (const EDestination *); /* "Jan
void e_destination_set_raw (EDestination *, const gchar *free_form_string);
const gchar *e_destination_get_textrep (const EDestination *); /* "Jane Smith" or "jane@assbarn.com" */
-gboolean e_destination_is_evolution_list (const EDestination *);
+gboolean e_destination_is_evolution_list (const EDestination *);
+gboolean e_destination_list_show_addresses (const EDestination *);
/* If true, they want HTML mail. */
gboolean e_destination_get_html_mail_pref (const EDestination *);
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 3647e01184..49de763015 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -794,7 +794,7 @@ extract_info(EContactListEditor *editor)
gtk_object_set (GTK_OBJECT(card),
"list", GINT_TO_POINTER (TRUE),
"list_show_addresses",
- GINT_TO_POINTER (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton))),
+ GINT_TO_POINTER (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton))),
NULL);
gtk_object_get (GTK_OBJECT(card),
@@ -846,7 +846,7 @@ fill_in_info(EContactListEditor *editor)
g_free (u);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton), show_addresses);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton), !show_addresses);
e_contact_list_model_remove_all (E_CONTACT_LIST_MODEL (editor->model));
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
}
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9c4a45d856..91f46fa083 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+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.
+
2001-08-22 Jeffrey Stedfast <fejj@ximian.com>
* component-factory.c (create_view): Don't blindly make all vtrash
@@ -291,8 +302,8 @@
* subscribe-dialog.c (fe_got_children): Sort the nodes here...
(fe_sort_folder): ... using this function.
- * folder-browser-ui.c (folder_browser_ui_message_loaded): Check for uic
- == NULL. I'm not sure how this could happen, but...
+ * folder-browser-ui.c (folder_browser_ui_message_loaded): Check
+ for uic == NULL. I'm not sure how this could happen, but...
2001-08-16 Peter Williams <peterw@ximian.com>
@@ -307,6 +318,17 @@
generate the the shell path of this item. Don't need to escape the
URL, and handle cases when dir_sep != '/'
(fe_done_subscribing): Use fe_node_to_shell_path instead of the
+ CamelURL. Third time's the charm... * folder-browser-ui.c
+ (folder_browser_ui_set_selection_state): Disable "Search Message"
+ when more or less than exactly one message is selected.
+
+ * subscribe-dialog.c (fe_done_subscribing): Instead of hackfully
+ getting the path, use a CamelURL so that escaping is
+ handled. Silly me. -- See below --
+ (fe_node_to_shell_path): Use node->name and node->full_name to
+ generate the the shell path of this item. Don't need to escape the
+ URL, and handle cases when dir_sep != '/'
+ (fe_done_subscribing): Use fe_node_to_shell_path instead of the
CamelURL. Third time's the charm...
2001-08-15 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 167ac0af55..12ec4d945f 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -235,7 +235,7 @@ ask_confirm_for_empty_subject (EMsgComposer *composer)
}
static gboolean
-ask_confirm_for_only_bcc (EMsgComposer *composer)
+ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
{
/* FIXME: EMessageBox should really handle this stuff
automagically. What Miguel thinks would be nice is to pass
@@ -246,13 +246,31 @@ ask_confirm_for_only_bcc (EMsgComposer *composer)
gboolean show_again = TRUE;
GtkWidget *mbox;
int button;
+ const gchar *first_text;
+ gchar *message_text;
if (!mail_config_get_prompt_only_bcc ())
return TRUE;
+
+ /* If the user is mailing a hidden contact list, it is possible for
+ them to create a message with only Bcc recipients without really
+ realizing it. To try to avoid being totally confusing, I've changed
+ this dialog to provide slightly different text in that case, to
+ better explain what the hell is going on. */
+
+ if (hidden_list_case) {
+ first_text = _("Since the contact list you are sending to "
+ "is configured to hide the list's addresses, "
+ "this message will contain only Bcc recipients.");
+ } else {
+ first_text = _("This message contains only Bcc recipients.");
+ }
+
+ message_text = g_strdup_printf ("%s\n%s", first_text,
+ _("It is possible that the mail server may reveal the recipients "
+ "by adding an Apparently-To header.\nSend anyway?"));
- 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?"),
+ mbox = e_message_box_new (message_text,
E_MESSAGE_BOX_QUESTION,
GNOME_STOCK_BUTTON_YES,
GNOME_STOCK_BUTTON_NO,
@@ -264,6 +282,8 @@ ask_confirm_for_only_bcc (EMsgComposer *composer)
button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox));
mail_config_set_prompt_only_bcc (show_again);
+
+ g_free (message_text);
if (button == 0)
return TRUE;
@@ -350,7 +370,21 @@ composer_get_message (EMsgComposer *composer)
if (iaddr && num_addrs == camel_address_length (CAMEL_ADDRESS (iaddr))) {
/* this means that the only recipients are Bcc's */
- if (!ask_confirm_for_only_bcc (composer)) {
+
+ /* OK, this is an abusive hack. If someone sends a mail with a
+ hidden contact list on to to: line and no other recipients,
+ they will unknowingly create a message with only bcc: recipients.
+ We try to detect this and pass a flag to ask_confirm_for_only_bcc,
+ so that it can present the user with a dialog whose text has been
+ modified to reflect this situation. */
+
+ const gchar *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
+ gboolean hidden_list_case = FALSE;
+
+ if (to_header && !strcmp (to_header, "Undisclosed-Recipient:;"))
+ hidden_list_case = TRUE;
+
+ if (!ask_confirm_for_only_bcc (composer, hidden_list_case)) {
camel_object_unref (CAMEL_OBJECT (message));
return NULL;
}