2004-11-18 [paul] 0.9.12cvs158.1
[claws.git] / src / compose.c
index 9075f69d018c830051913a52239f1a7d740ce6b1..9d5a50899fef8e10ee8bc260816f98a69dc49897 100644 (file)
@@ -2218,7 +2218,7 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                        MsgInfo *msginfo;
                        MsgFlags flags = {0, 0};
 
-                       if (procmime_get_encoding_for_file(file) == ENC_7BIT)
+                       if (procmime_get_encoding_for_text_file(file) == ENC_7BIT)
                                ainfo->encoding = ENC_7BIT;
                        else
                                ainfo->encoding = ENC_8BIT;
@@ -2234,8 +2234,7 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                        procmsg_msginfo_free(msginfo);
                } else {
                        if (!g_ascii_strncasecmp(content_type, "text", 4))
-                               ainfo->encoding =
-                                       procmime_get_encoding_for_file(file);
+                               ainfo->encoding = procmime_get_encoding_for_text_file(file);
                        else
                                ainfo->encoding = ENC_BASE64;
                        name = g_path_get_basename(filename ? filename : file);
@@ -2249,7 +2248,8 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                                g_strdup("application/octet-stream");
                        ainfo->encoding = ENC_BASE64;
                } else if (!g_ascii_strncasecmp(ainfo->content_type, "text", 4))
-                       ainfo->encoding = procmime_get_encoding_for_file(file);
+                       ainfo->encoding =
+                               procmime_get_encoding_for_text_file(file);
                else
                        ainfo->encoding = ENC_BASE64;
                name = g_path_get_basename(filename ? filename : file);
@@ -3320,7 +3320,16 @@ gint compose_send(Compose *compose)
                folder_item_scan(folder);
                if (prefs_common.send_dialog_mode == SEND_DIALOG_ALWAYS)
                        gtk_widget_destroy(compose->window);
-       }
+       } else {
+               alertpanel_error(_("The message was queued but could not be "
+                                  "sent.\nUse \"Send queued messages\" from "
+                                  "the main window to retry."));
+               if (prefs_common.send_dialog_mode == SEND_DIALOG_ALWAYS) {
+                       compose_allow_user_actions (compose, TRUE);
+                       compose->sending = FALSE;               
+               }
+               return -1;
+       }
 
        return 0;
 
@@ -3437,7 +3446,7 @@ static gint compose_redirect_write_headers(Compose *compose, FILE *fp)
 
        /* Resent-Message-ID */
        if (compose->account->gen_msgid) {
-               generate_msgid(compose->account->address, buf, sizeof(buf));
+               generate_msgid(buf, sizeof(buf));
                fprintf(fp, "Resent-Message-ID: <%s>\n", buf);
                compose->msgid = g_strdup(buf);
        }
@@ -3852,7 +3861,9 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item,
                        gchar *encdata;
 
                        encdata = privacy_get_encrypt_data(compose->privacy_system, compose->to_list);
-                       fprintf(fp, "X-Sylpheed-Encrypt-Data:%s\n", encdata);
+                       if (encdata != NULL)
+                               fprintf(fp, "X-Sylpheed-Encrypt-Data:%s\n", 
+                                       encdata);
                        g_free(encdata);
                }
        }
@@ -4122,26 +4133,18 @@ static gchar *compose_get_header(Compose *compose)
        /* Subject */
        str = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1);
        if (*str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) {
-               gchar *tmpstr;
-
-               tmpstr = g_strdup(str);
-               if (tmpstr == NULL) {
-                       g_string_free(header, TRUE);
-                       return NULL;
-               }
                g_strstrip(str);
                if (*str != '\0') {
                        compose_convert_header(buf, sizeof(buf), str,
                                               strlen("Subject: "), FALSE);
                        g_string_append_printf(header, "Subject: %s\n", buf);
                }
-               g_free(tmpstr);
        }
        g_free(str);
 
        /* Message-ID */
        if (compose->account->gen_msgid) {
-               generate_msgid(compose->account->address, buf, sizeof(buf));
+               generate_msgid(buf, sizeof(buf));
                g_string_append_printf(header, "Message-ID: <%s>\n", buf);
                compose->msgid = g_strdup(buf);
        }