2005-10-13 [colin] 1.9.15cvs41
authorColin Leroy <colin@colino.net>
Thu, 13 Oct 2005 18:06:13 +0000 (18:06 +0000)
committerColin Leroy <colin@colino.net>
Thu, 13 Oct 2005 18:06:13 +0000 (18:06 +0000)
* src/compose.c
Set subject when forwarding multiple mails
Check that other recipient than the default Cc or Bcc
have been set before sending.

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/compose.c

index 4e0e49b83f520d588dd01731e696001f57bd5b55..57ddbcc071c5f25a7ef9966ad79ddfdca4e97f43 100644 (file)
@@ -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
index 14eaba6696fa1ea86e5d4176b207905249c6e457..da5146652cdc7f5f1817e6dafbfbb095d93d4720 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 88eac3d0e3e2b41cfa4b8efdf64adf6412fa00c2..bd8cf3aff59b6056c490e1d7ee5461deedc5c916 100644 (file)
@@ -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=
 
index d7e43829d937e75ea51bca7f2626b238254a674c..27bc06e32d6b5cab12465663a3017ce1937ebb2a 100644 (file)
@@ -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;