Re: [Evolution] Reply for list messages should go back to the list
- From: David Woodhouse <dwmw2 infradead org>
- To: Kåre Fiedler Christiansen <fedora kaarefc dk>
- Cc: evolution lists lists <evolution-list gnome org>
- Subject: Re: [Evolution] Reply for list messages should go back to the list
- Date: Tue, 13 Jul 2010 20:38:51 +0100
On Tue, 2010-07-13 at 20:48 +0200, KÃre Fiedler Christiansen wrote:
It seems to me that people are split in two camps:
* Those who want full control over who to reply to when, and same
short-cuts always
* Those who want Evolution to try to be intelligent about where to
reply to, by somehow magically detecting the "appropriate" way to
reply
I think it's best for Evolution always to do what you ask it.
But there are a lot of stupid people out there who ask it to do the
wrong thing, so I think the best option is to prompt them -- hence my
patch to say "are you sure you want to reply privately?" when replying
to a mailing list.
And this one to say "are you sure you want to reply to all?" when you
reply to a message with lots of recipients. Unless it's a mailing list
message.
I've resisted putting a precise figure on 'many' in the UI, although you
can see in the code below that it's currently set to 15. The problem is
that camel_message_info_cc() and camel_message_info_to() actually return
corrupted headers -- the quotes around display-names (which I so
carefully avoided counting within) have been removed. To work around
that bug, I'd have to actually fetch the message. Which I suppose we're
going to have to do anyway if we *do* reply, but it makes it a lot
messier.
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 26048c5..1a5a42c 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -823,7 +823,41 @@ static void
action_mail_reply_all_cb (GtkAction *action,
EMailReader *reader)
{
- e_mail_reader_reply_to_message (reader, REPLY_MODE_ALL);
+ gint mode = REPLY_MODE_ALL;
+ guint32 state = e_mail_reader_check_state (reader);
+ GConfClient *gconf = mail_config_get_gconf_client ();
+
+ if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/reply_many_recips", NULL) &&
+ (state & E_MAIL_READER_SELECTION_MANY_RECIPIENTS) &&
+ !(state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) {
+ GtkDialog *dialog;
+ GtkWidget *content_area, *check;
+ gint response;
+
+ dialog = (GtkDialog*) e_alert_dialog_new_for_args (e_mail_reader_get_window (reader),
+ "mail:ask-reply-many-recips", NULL);
+
+ /*Check buttons*/
+ check = gtk_check_button_new_with_mnemonic (_("_Do not ask me again."));
+ gtk_container_set_border_width((GtkContainer *)check, 12);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_box_pack_start (GTK_BOX (content_area), check, TRUE, TRUE, 0);
+ gtk_widget_show (check);
+
+ response = gtk_dialog_run ((GtkDialog *) dialog);
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)))
+ gconf_client_set_bool(gconf, "/apps/evolution/mail/prompts/reply_many_recips", FALSE,
NULL);
+
+ gtk_widget_destroy((GtkWidget *)dialog);
+
+ if (response == GTK_RESPONSE_NO)
+ mode = REPLY_MODE_SENDER;
+ else if (response == GTK_RESPONSE_CANCEL)
+ return;
+ }
+
+ e_mail_reader_reply_to_message (reader, mode);
}
static void
@@ -2775,6 +2809,32 @@ e_mail_reader_changed (EMailReader *reader)
g_signal_emit (reader, signals[CHANGED], 0);
}
+static gint count_header_recipients (const gchar *hdr)
+{
+ const gchar *p = hdr;
+ gint found = 1;
+
+ if (!p || !*p)
+ return 0;
+
+ while (*p) {
+ if (*p == '"') {
+ p = strchr(p + 1, '"');
+ if (!p)
+ return found;
+ } else if (*p == ',')
+ found++;
+ p++;
+ }
+ return found;
+}
+
+static gint count_message_recipients (CamelMessageInfo *info)
+{
+ return count_header_recipients (camel_message_info_to(info)) +
+ count_header_recipients (camel_message_info_cc(info);
+}
+
guint32
e_mail_reader_check_state (EMailReader *reader)
{
@@ -2798,6 +2858,7 @@ e_mail_reader_check_state (EMailReader *reader)
gboolean store_supports_vjunk = FALSE;
gboolean is_mailing_list;
gboolean is_junk_folder = FALSE;
+ gboolean has_many_recipients = FALSE;
guint32 state = 0;
guint ii;
@@ -2893,6 +2954,9 @@ e_mail_reader_check_state (EMailReader *reader)
string = camel_message_info_mlist (info);
is_mailing_list &= (string != NULL && *string != '\0');
+ if (count_message_recipients (info) >= 10)
+ has_many_recipients = TRUE;
+
camel_folder_free_message_info (folder, info);
}
@@ -2930,6 +2994,8 @@ e_mail_reader_check_state (EMailReader *reader)
state |= E_MAIL_READER_SELECTION_IS_MAILING_LIST;
if (is_junk_folder)
state |= E_MAIL_READER_FOLDER_IS_JUNK;
+ if (has_many_recipients)
+ state |= E_MAIL_READER_SELECTION_MANY_RECIPIENTS;
em_utils_uids_free (uids);
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index 53fcd09..9818a0a 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -76,7 +76,9 @@ enum {
E_MAIL_READER_SELECTION_HAS_UNIMPORTANT = 1 << 13,
E_MAIL_READER_SELECTION_HAS_UNREAD = 1 << 14,
E_MAIL_READER_SELECTION_IS_MAILING_LIST = 1 << 15,
- E_MAIL_READER_FOLDER_IS_JUNK = 1 << 16
+ E_MAIL_READER_FOLDER_IS_JUNK = 1 << 16,
+ E_MAIL_READER_SELECTION_MANY_RECIPIENTS = 1 << 17,
+
};
struct _EMailReaderIface {
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 8956974..a8024a7 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -1067,6 +1067,21 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/evolution/mail/prompts/reply_many_recips</key>
+ <applyto>/apps/evolution/mail/prompts/reply_many_recips</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Prompt when replying to many recipients</short>
+ <long>
+ It disables/enables the repeated prompts to warn that you are
+ sending a reply to many people.
+ </long>
+ </locale>
+ </schema>
+
<!-- Trash settings -->
<schema>
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 3817d06..6c1f57b 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -4816,6 +4816,21 @@ For example: "Work" or "Personal"</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="chkPromptReplyManyRecips">
+ <property name="label" translatable="yes">Prompt when sending replies to _many
recipients</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index a9be483..962a509 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -67,6 +67,14 @@ Many email systems add an Apparently-To header to messages that only have BCC re
<button response="GTK_RESPONSE_OK" _label="Reply to _List"></button>
</error>
+ <error id="ask-reply-many-recips" type="question" default="GTK_RESPONSE_CANCEL">
+ <_primary>Send reply to all recipients?</_primary>
+ <_secondary>You are replying to a message which was sent to many recipients. Are you sure you want to
reply to ALL of them?</_secondary>
+ <button response="GTK_RESPONSE_YES" _label="Reply to _All"></button>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ <button response="GTK_RESPONSE_NO" _label="Reply _Privately"/>
+ </error>
+
<error id="send-no-recipients" type="warning">
<_primary>This message cannot be sent because you have not specified any recipients</_primary>
<_secondary xml:space="preserve">Please enter a valid email address in the To: field. You can search for
email addresses by clicking on the To: button next to the entry box.</_secondary>
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index d46972f..97b5891 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -224,6 +224,10 @@ e_mail_shell_settings_init (EShell *shell)
"/apps/evolution/mail/prompts/private_list_reply");
e_shell_settings_install_property_for_key (
+ "composer-prompt-reply-many-recips",
+ "/apps/evolution/mail/prompts/reply-many-recips");
+
+ e_shell_settings_install_property_for_key (
"composer-prompt-empty-subject",
"/apps/evolution/mail/prompts/empty_subject");
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 0ea3d34..15f1416 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -424,6 +424,11 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
shell_settings, "composer-prompt-private-list-reply",
widget, "active");
+ widget = e_builder_get_widget (prefs->builder, "chkPromptReplyManyRecips");
+ e_mutual_binding_new (
+ shell_settings, "composer-prompt-reply-many-recips",
+ widget, "active");
+
widget = e_builder_get_widget (prefs->builder, "chkAutoSmileys");
e_mutual_binding_new (
shell_settings, "composer-magic-smileys",
--
dwmw2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]