From: Colin Leroy Date: Thu, 13 Oct 2005 18:06:13 +0000 (+0000) Subject: 2005-10-13 [colin] 1.9.15cvs41 X-Git-Tag: rel_1_9_99~96 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=6d275752b162a88714490620e7323c703ce09620;ds=sidebyside 2005-10-13 [colin] 1.9.15cvs41 * src/compose.c Set subject when forwarding multiple mails Check that other recipient than the default Cc or Bcc have been set before sending. --- diff --git a/ChangeLog-gtk2.claws b/ChangeLog-gtk2.claws index 4e0e49b83..57ddbcc07 100644 --- a/ChangeLog-gtk2.claws +++ b/ChangeLog-gtk2.claws @@ -1,3 +1,10 @@ +2005-10-13 [colin] 1.9.15cvs41 + + * src/compose.c + Set subject when forwarding multiple mails + Check that other recipient than the default Cc or Bcc + have been set before sending. + 2005-10-13 [colin] 1.9.15cvs40 * src/imap.c diff --git a/PATCHSETS b/PATCHSETS index 14eaba669..da5146652 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -877,3 +877,4 @@ ( cvs diff -u -r 1.395.2.135 -r 1.395.2.136 src/summaryview.c; ) > 1.9.15cvs38.patchset ( cvs diff -u -r 1.1.2.22 -r 1.1.2.23 src/gtk/quicksearch.c; ) > 1.9.15cvs39.patchset ( cvs diff -u -r 1.179.2.78 -r 1.179.2.79 src/imap.c; ) > 1.9.15cvs40.patchset +( cvs diff -u -r 1.382.2.183 -r 1.382.2.184 src/compose.c; ) > 1.9.15cvs41.patchset diff --git a/configure.ac b/configure.ac index 88eac3d0e..bd8cf3aff 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=15 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=40 +EXTRA_VERSION=41 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/compose.c b/src/compose.c index d7e43829d..27bc06e32 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1346,9 +1346,13 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list) GtkTextIter iter; GSList *msginfo; gchar *msgfile; - + gboolean single_mail = TRUE; + g_return_val_if_fail(msginfo_list != NULL, NULL); + if (g_slist_length(msginfo_list) > 1) + single_mail = FALSE; + for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) if (((MsgInfo *)msginfo->data)->folder == NULL) return NULL; @@ -1381,6 +1385,26 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list) "message/rfc822"); g_free(msgfile); } + + if (single_mail) { + MsgInfo *info = (MsgInfo *)msginfo_list->data; + if (info->subject && *info->subject) { + gchar *buf, *buf2, *p; + + buf = p = g_strdup(info->subject); + p += subject_get_prefix_length(p); + memmove(buf, p, strlen(p) + 1); + + buf2 = g_strdup_printf("Fw: %s", buf); + gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf2); + + g_free(buf); + g_free(buf2); + } + } else { + gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), + _("Fw: multiple emails")); + } if (account->auto_sig) compose_insert_sig(compose, FALSE); @@ -3467,6 +3491,67 @@ gboolean compose_check_for_valid_recipient(Compose *compose) { return recipient_found; } +static gboolean compose_check_for_set_recipients(Compose *compose) +{ + if (compose->account->set_autocc && compose->account->auto_cc) { + gboolean found_other = FALSE; + GSList *list; + /* search header entries for to and newsgroup entries */ + for (list = compose->header_list; list; list = list->next) { + gchar *entry; + gchar *header; + entry = gtk_editable_get_chars(GTK_EDITABLE(((ComposeHeaderEntry *)list->data)->entry), 0, -1); + header = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(((ComposeHeaderEntry *)list->data)->combo)->entry), 0, -1); + g_strstrip(entry); + if (strcmp(entry, compose->account->auto_cc) + || strcmp(header, (prefs_common.trans_hdr ? gettext("Cc:") : "Cc:"))) { + found_other = TRUE; + g_free(entry); + break; + } + g_free(entry); + g_free(header); + } + if (!found_other) { + AlertValue aval; + aval = alertpanel(_("Send"), + _("The only recipient is the default CC address. Send anyway?"), + GTK_STOCK_YES, GTK_STOCK_NO, NULL); + if (aval != G_ALERTDEFAULT) + return FALSE; + } + } + if (compose->account->set_autobcc && compose->account->auto_bcc) { + gboolean found_other = FALSE; + GSList *list; + /* search header entries for to and newsgroup entries */ + for (list = compose->header_list; list; list = list->next) { + gchar *entry; + gchar *header; + entry = gtk_editable_get_chars(GTK_EDITABLE(((ComposeHeaderEntry *)list->data)->entry), 0, -1); + header = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(((ComposeHeaderEntry *)list->data)->combo)->entry), 0, -1); + g_strstrip(entry); + if (strcmp(entry, compose->account->auto_cc) + || strcmp(header, (prefs_common.trans_hdr ? gettext("Bcc:") : "Bcc:"))) { + found_other = TRUE; + g_free(entry); + break; + } + g_free(entry); + g_free(header); + } + if (!found_other) { + AlertValue aval; + aval = alertpanel(_("Send"), + _("The only recipient is the default BCC address. Send anyway?"), + GTK_STOCK_YES, GTK_STOCK_NO, NULL); + if (aval != G_ALERTDEFAULT) + return FALSE; + } + } + return TRUE; +} + static gboolean compose_check_entries(Compose *compose, gboolean check_subject) { const gchar *str; @@ -3476,6 +3561,10 @@ static gboolean compose_check_entries(Compose *compose, gboolean check_subject) return FALSE; } + if (compose_check_for_set_recipients(compose) == FALSE) { + return FALSE; + } + str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry)); if (*str == '\0' && check_subject == TRUE) { AlertValue aval;