[Commits] [SCM] claws branch, master, updated. 3.14.1-125-gd1d7ad9
wwp at claws-mail.org
wwp at claws-mail.org
Thu Jan 12 17:29:23 CET 2017
The branch, master has been updated
via d1d7ad9aad01a8dfa3c8e7045343d8775a9437c5 (commit)
from 1ee234f75c32179a487d1946ddf08dc1033ff1c5 (commit)
Summary of changes:
src/compose.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++---
src/prefs_common.c | 4 ++++
src/prefs_common.h | 2 ++
3 files changed, 57 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit d1d7ad9aad01a8dfa3c8e7045343d8775a9437c5
Author: wwp <wwp at free.fr>
Date: Thu Jan 12 17:26:30 2017 +0100
Warn when sending to more than N recipients. This features obeys
to a couple of hidden prefs:
warn_sending_many_recipients (TRUE/FALSE)
warn_sending_many_recipients_num (1-1000)
diff --git a/src/compose.c b/src/compose.c
index 71b96d1..0c14790 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -313,7 +313,7 @@ static gint compose_queue_sub (Compose *compose,
gint *msgnum,
FolderItem **item,
gchar **msgpath,
- gboolean check_subject,
+ gboolean perform_checks,
gboolean remove_reedit_target);
static int compose_add_attachments (Compose *compose,
MimeInfo *parent);
@@ -5132,6 +5132,54 @@ static gboolean compose_check_entries(Compose *compose, gboolean check_everythin
}
}
+ if (!compose->batch && prefs_common.warn_sending_many_recipients == TRUE
+ && check_everything == TRUE) {
+ GSList *list;
+ gint cnt = 0;
+
+ /* count To and Cc recipients */
+ for (list = compose->header_list; list; list = list->next) {
+ gchar *header;
+ gchar *entry;
+
+ header = gtk_editable_get_chars(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN((((ComposeHeaderEntry *)list->data)->combo)))), 0, -1);
+ entry = gtk_editable_get_chars(GTK_EDITABLE(((ComposeHeaderEntry *)list->data)->entry), 0, -1);
+ g_strstrip(header);
+ g_strstrip(entry);
+ if ((entry[0] != '\0')
+ && (strcmp(header, prefs_common_translated_header_name("To:"))
+ || strcmp(header, prefs_common_translated_header_name("Cc:")))) {
+ cnt++;
+ }
+ g_free(header);
+ g_free(entry);
+ }
+ if (cnt > prefs_common.warn_sending_many_recipients_num) {
+ AlertValue aval;
+ gchar *button_label;
+ gchar *message;
+
+ if (compose->sending)
+ button_label = g_strconcat("+", _("_Send"), NULL);
+ else
+ button_label = g_strconcat("+", _("_Queue"), NULL);
+ message = g_strdup_printf(_("Sending to %d recipients. %s"), cnt,
+ compose->sending?_("Send it anyway?"):
+ _("Queue it anyway?"));
+
+ aval = alertpanel_full(compose->sending?_("Send"):_("Send later"), message,
+ GTK_STOCK_CANCEL, button_label, NULL, TRUE, NULL,
+ ALERT_QUESTION, G_ALERTDEFAULT);
+ g_free(message);
+ if (aval & G_ALERTDISABLE) {
+ aval &= ~G_ALERTDISABLE;
+ prefs_common.warn_empty_subj = FALSE;
+ }
+ if (aval != G_ALERTALTERNATE)
+ return FALSE;
+ }
+ }
+
if (check_everything && hooks_invoke(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, compose))
return FALSE;
@@ -5940,7 +5988,7 @@ static gboolean compose_warn_encryption(Compose *compose)
}
static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
- gchar **msgpath, gboolean check_subject,
+ gchar **msgpath, gboolean perform_checks,
gboolean remove_reedit_target)
{
FolderItem *queue;
@@ -5954,7 +6002,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
debug_print("queueing message...\n");
cm_return_val_if_fail(compose->account != NULL, -1);
- if (compose_check_entries(compose, check_subject) == FALSE) {
+ if (compose_check_entries(compose, perform_checks) == FALSE) {
if (compose->batch) {
gtk_widget_show_all(compose->window);
}
diff --git a/src/prefs_common.c b/src/prefs_common.c
index ea276b0..b0def0d 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -203,6 +203,10 @@ static PrefParam param[] = {
P_BOOL, NULL, NULL, NULL},
{"warn_empty_subj", "TRUE", &prefs_common.warn_empty_subj,
P_BOOL, NULL, NULL, NULL},
+ {"warn_sending_many_recipients", "FALSE", &prefs_common.warn_sending_many_recipients,
+ P_BOOL, NULL, NULL, NULL},
+ {"warn_sending_many_recipients_num", "1", &prefs_common.warn_sending_many_recipients_num, P_INT,
+ NULL, NULL, NULL},
{"hide_timezone", "FALSE", &prefs_common.hide_timezone,
P_BOOL, NULL, NULL, NULL},
{"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index 45db9c6..505d4dc 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -144,6 +144,8 @@ struct _PrefsCommon
gboolean outgoing_fallback_to_ascii;
gboolean rewrite_first_from;
gboolean warn_empty_subj;
+ gboolean warn_sending_many_recipients;
+ gint warn_sending_many_recipients_num;
gboolean hide_timezone;
gboolean allow_jisx0201_kana;
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list