aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-04-24 06:07:10 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-04-24 06:07:10 +0000
commita1d16d5c974ca414b1b6234bfd34c78ae0f97d18 (patch)
tree43a45cb0494793d76b6e5f1466d217d6aecc1530 /src
parent8390e12e45f209a0174318ed529068595c7f70d3 (diff)
added option of excluded addresses/domains for recipients confirmation.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1985 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/compose.c46
-rw-r--r--src/prefs_common_dialog.c34
2 files changed, 77 insertions, 3 deletions
diff --git a/src/compose.c b/src/compose.c
index 8df6a948..b6b496ce 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -2972,6 +2972,7 @@ static gboolean compose_check_recipients(Compose *compose)
GtkStyle *style;
GSList *cur, *to_list = NULL;
+ gboolean check_recp = FALSE;
gint state = 0;
g_return_val_if_fail(compose->account != NULL, FALSE);
@@ -2980,6 +2981,51 @@ static gboolean compose_check_recipients(Compose *compose)
if (!prefs_common.check_recipients)
return TRUE;
+ if (prefs_common.check_recp_exclude) {
+ gchar **strv;
+ gint i;
+
+ strv = g_strsplit(prefs_common.check_recp_exclude, ",", -1);
+ for (i = 0; strv[i] != NULL; i++)
+ g_strstrip(strv[i]);
+
+ if (compose->use_to) {
+ text = gtk_entry_get_text(GTK_ENTRY(compose->to_entry));
+ to_list = address_list_append_orig(NULL, text);
+ }
+ if (compose->use_cc) {
+ text = gtk_entry_get_text(GTK_ENTRY(compose->cc_entry));
+ to_list = address_list_append_orig(to_list, text);
+ }
+ if (compose->use_bcc) {
+ text = gtk_entry_get_text(GTK_ENTRY(compose->bcc_entry));
+ to_list = address_list_append_orig(to_list, text);
+ }
+
+ for (cur = to_list; cur != NULL; cur = cur->next) {
+ for (i = 0; strv[i] != NULL; i++) {
+ if (strv[i][0] == '\0')
+ continue;
+ if (strcasestr((gchar *)cur->data, strv[i]))
+ break;
+ }
+ if (!strv[i]) {
+ /* not found in exclude list */
+ check_recp = TRUE;
+ break;
+ }
+ }
+
+ slist_free_strings(to_list);
+ g_slist_free(to_list);
+ to_list = NULL;
+ g_strfreev(strv);
+ } else
+ check_recp = TRUE;
+
+ if (!check_recp)
+ return TRUE;
+
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(window), 8);
gtk_window_set_title(GTK_WINDOW(window), _("Check recipients"));
diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c
index 4ff57334..15fcbf18 100644
--- a/src/prefs_common_dialog.c
+++ b/src/prefs_common_dialog.c
@@ -85,6 +85,7 @@ static struct Send {
GtkWidget *checkbtn_check_attach;
GtkWidget *entry_check_attach_str;
GtkWidget *checkbtn_check_recp;
+ GtkWidget *entry_check_recp_excl;
} p_send;
static struct Compose {
@@ -301,6 +302,8 @@ static PrefsUIData ui_data[] = {
prefs_set_data_from_entry, prefs_set_entry},
{"check_recipients", &p_send.checkbtn_check_recp,
prefs_set_data_from_toggle, prefs_set_toggle},
+ {"check_recp_exclude", &p_send.entry_check_recp_excl,
+ prefs_set_data_from_entry, prefs_set_entry},
/* {"allow_jisx0201_kana", NULL, NULL, NULL}, */
@@ -885,6 +888,7 @@ static void prefs_send_create(void)
GtkWidget *checkbtn_check_attach;
GtkWidget *entry_check_attach_str;
GtkWidget *checkbtn_check_recp;
+ GtkWidget *entry_check_recp_excl;
vbox1 = gtk_vbox_new (FALSE, VSPACING);
gtk_widget_show (vbox1);
@@ -961,13 +965,17 @@ static void prefs_send_create(void)
"MIME header: most popular, but violates RFC 2047\n"
"RFC 2231: conforms to standard, but not popular"));
- PACK_CHECK_BUTTON (vbox1, checkbtn_check_attach,
+ vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
+ gtk_widget_show (vbox2);
+ gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
+
+ PACK_CHECK_BUTTON (vbox2, checkbtn_check_attach,
_("Notify for missing attachments when the following strings (comma-separated) are found in the message body"));
gtk_label_set_line_wrap(GTK_LABEL(GTK_BIN(checkbtn_check_attach)->child), TRUE);
hbox1 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox1);
- gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
entry_check_attach_str = gtk_entry_new ();
gtk_widget_show (entry_check_attach_str);
@@ -979,9 +987,28 @@ static void prefs_send_create(void)
SET_TOGGLE_SENSITIVITY(checkbtn_check_attach, entry_check_attach_str);
- PACK_CHECK_BUTTON (vbox1, checkbtn_check_recp,
+ vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
+ gtk_widget_show (vbox2);
+ gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
+
+ PACK_CHECK_BUTTON (vbox2, checkbtn_check_recp,
_("Confirm recipients before sending"));
+ hbox1 = gtk_hbox_new (FALSE, 8);
+ gtk_widget_show (hbox1);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+ label = gtk_label_new
+ (_("Excluded addresses/domains (comma-separated):"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
+
+ entry_check_recp_excl = gtk_entry_new ();
+ gtk_widget_show (entry_check_recp_excl);
+ gtk_box_pack_start (GTK_BOX (vbox2), entry_check_recp_excl,
+ FALSE, FALSE, 0);
+
+ SET_TOGGLE_SENSITIVITY(checkbtn_check_recp, entry_check_recp_excl);
+
p_send.checkbtn_savemsg = checkbtn_savemsg;
p_send.checkbtn_filter_sent = checkbtn_filter_sent;
@@ -991,6 +1018,7 @@ static void prefs_send_create(void)
p_send.checkbtn_check_attach = checkbtn_check_attach;
p_send.entry_check_attach_str = entry_check_attach_str;
p_send.checkbtn_check_recp = checkbtn_check_recp;
+ p_send.entry_check_recp_excl = entry_check_recp_excl;
}
static void prefs_compose_create(void)