From a1d16d5c974ca414b1b6234bfd34c78ae0f97d18 Mon Sep 17 00:00:00 2001 From: hiro Date: Thu, 24 Apr 2008 06:07:10 +0000 Subject: added option of excluded addresses/domains for recipients confirmation. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1985 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/compose.c') 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")); -- cgit v1.2.3