COL_MIMETYPE = 0,
COL_SIZE = 1,
COL_NAME = 2,
- COL_DATA = 3,
- COL_AUTODATA = 4,
+ COL_CHARSET = 3,
+ COL_DATA = 4,
+ COL_AUTODATA = 5,
N_COL_COLUMNS
};
static gboolean compose_attach_append (Compose *compose,
const gchar *file,
const gchar *type,
- const gchar *content_type);
+ const gchar *content_type,
+ const gchar *charset);
static void compose_attach_parts (Compose *compose,
MsgInfo *msginfo);
for (i = 0; i < attach_files->len; i++) {
file = g_ptr_array_index(attach_files, i);
- compose_attach_append(compose, file, file, NULL);
+ compose_attach_append(compose, file, file, NULL, NULL);
}
}
GtkTextView *textview;
GtkTextBuffer *textbuf;
GtkTextIter iter;
+ ComposeMode mode;
cm_return_val_if_fail(msginfo != NULL, NULL);
cm_return_val_if_fail(msginfo->folder != NULL, NULL);
(msginfo)))
account = cur_account;
- compose = compose_create(account, msginfo->folder, COMPOSE_FORWARD, batch);
+ if (!prefs_common.forward_as_attachment)
+ mode = COMPOSE_FORWARD_INLINE;
+ else
+ mode = COMPOSE_FORWARD;
+ compose = compose_create(account, msginfo->folder, mode, batch);
compose->updating = TRUE;
compose->fwdinfo = procmsg_msginfo_get_full_info(msginfo);
g_warning("%s: file not exist\n", msgfile);
else
compose_attach_append(compose, msgfile, msgfile,
- "message/rfc822");
+ "message/rfc822", NULL);
g_free(msgfile);
} else {
g_warning("%s: file not exist\n", msgfile);
else
compose_attach_append(compose, msgfile, msgfile,
- "message/rfc822");
+ "message/rfc822", NULL);
g_free(msgfile);
}
while (attach[i] != NULL) {
gchar *utf8_filename = conv_filename_to_utf8(attach[i]);
if (utf8_filename) {
- if (compose_attach_append(compose, attach[i], utf8_filename, NULL)) {
+ if (compose_attach_append(compose, attach[i], utf8_filename, NULL, NULL)) {
gchar *tmp = g_strdup_printf("%s%s\n",
warn_files?warn_files:"",
utf8_filename);
if (hentry[H_REPLY_TO].body[0] != '\0') {
compose->replyto =
conv_unmime_header(hentry[H_REPLY_TO].body,
- NULL);
+ NULL, TRUE);
}
g_free(hentry[H_REPLY_TO].body);
hentry[H_REPLY_TO].body = NULL;
}
if (hentry[H_CC].body != NULL) {
- compose->cc = conv_unmime_header(hentry[H_CC].body, NULL);
+ compose->cc = conv_unmime_header(hentry[H_CC].body, NULL, TRUE);
g_free(hentry[H_CC].body);
hentry[H_CC].body = NULL;
}
if (hentry[H_BCC].body != NULL) {
if (compose->mode == COMPOSE_REEDIT)
compose->bcc =
- conv_unmime_header(hentry[H_BCC].body, NULL);
+ conv_unmime_header(hentry[H_BCC].body, NULL, TRUE);
g_free(hentry[H_BCC].body);
hentry[H_BCC].body = NULL;
}
if (hentry[H_FOLLOWUP_TO].body[0] != '\0') {
compose->followup_to =
conv_unmime_header(hentry[H_FOLLOWUP_TO].body,
- NULL);
+ NULL, TRUE);
}
g_free(hentry[H_FOLLOWUP_TO].body);
hentry[H_FOLLOWUP_TO].body = NULL;
static gboolean compose_attach_append(Compose *compose, const gchar *file,
const gchar *filename,
- const gchar *content_type)
+ const gchar *content_type,
+ const gchar *charset)
{
AttachInfo *ainfo;
GtkTreeIter iter;
if (file_from_uri && is_file_exist(file_from_uri)) {
result = compose_attach_append(
compose, file_from_uri,
- filename,
- content_type);
+ filename, content_type,
+ charset);
}
g_free(file_from_uri);
if (result)
procmsg_msginfo_free(msginfo);
} else {
- if (!g_ascii_strncasecmp(content_type, "text", 4))
+ if (!g_ascii_strncasecmp(content_type, "text/", 5)) {
+ ainfo->charset = g_strdup(charset);
ainfo->encoding = procmime_get_encoding_for_text_file(file, &has_binary);
- else
+ } else {
ainfo->encoding = ENC_BASE64;
+ }
name = g_path_get_basename(filename ? filename : file);
ainfo->name = g_strdup(name);
}
ainfo->content_type =
g_strdup("application/octet-stream");
ainfo->encoding = ENC_BASE64;
- } else if (!g_ascii_strncasecmp(ainfo->content_type, "text", 4))
+ } else if (!g_ascii_strncasecmp(ainfo->content_type, "text/", 5))
ainfo->encoding =
procmime_get_encoding_for_text_file(file, &has_binary);
else
if (!strcmp(ainfo->content_type, "unknown") || has_binary) {
g_free(ainfo->content_type);
ainfo->content_type = g_strdup("application/octet-stream");
+ g_free(ainfo->charset);
+ ainfo->charset = NULL;
}
ainfo->size = (goffset)size;
COL_MIMETYPE, ainfo->content_type,
COL_SIZE, size_text,
COL_NAME, ainfo->name,
+ COL_CHARSET, ainfo->charset,
COL_DATA, ainfo,
COL_AUTODATA, auto_ainfo,
-1);
if (partname == NULL)
partname = "";
compose_attach_append(compose, outfile,
- partname, content_type);
+ partname, content_type,
+ procmime_mimeinfo_get_parameter(child, "charset"));
} else {
compose_force_signing(compose, compose->account, NULL);
}
if (mimepart->type == MIMETYPE_MESSAGE &&
!g_ascii_strcasecmp(mimepart->subtype, "rfc822")) {
mimepart->disposition = DISPOSITIONTYPE_INLINE;
- } else {
- if (ainfo->name) {
- if (mimepart->type == MIMETYPE_APPLICATION &&
- !strcmp2(mimepart->subtype, "octet-stream"))
- g_hash_table_insert(mimepart->typeparameters,
- g_strdup("name"), g_strdup(ainfo->name));
- g_hash_table_insert(mimepart->dispositionparameters,
- g_strdup("filename"), g_strdup(ainfo->name));
+ } else if (mimepart->type == MIMETYPE_TEXT) {
+ if (!ainfo->name && compose->mode == COMPOSE_FORWARD_INLINE) {
+ /* Text parts with no name come from multipart/alternative
+ * forwards. Make sure the recipient won't look at the
+ * original HTML part by mistake. */
mimepart->disposition = DISPOSITIONTYPE_ATTACHMENT;
+ ainfo->name = g_strdup_printf(_("Original %s part"),
+ mimepart->subtype);
}
+ if (ainfo->charset)
+ g_hash_table_insert(mimepart->typeparameters,
+ g_strdup("charset"), g_strdup(ainfo->charset));
+ }
+ if (ainfo->name && mimepart->type != MIMETYPE_MESSAGE) {
+ if (mimepart->type == MIMETYPE_APPLICATION &&
+ !strcmp2(mimepart->subtype, "octet-stream"))
+ g_hash_table_insert(mimepart->typeparameters,
+ g_strdup("name"), g_strdup(ainfo->name));
+ g_hash_table_insert(mimepart->dispositionparameters,
+ g_strdup("filename"), g_strdup(ainfo->name));
+ mimepart->disposition = DISPOSITIONTYPE_ATTACHMENT;
}
if (mimepart->type == MIMETYPE_MESSAGE
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING,
G_TYPE_POINTER,
G_TYPE_AUTO_POINTER,
-1);
titles[COL_MIMETYPE] = _("MIME type");
titles[COL_SIZE] = _("Size");
titles[COL_NAME] = _("Name");
+ titles[COL_CHARSET] = _("Charset");
compose->batch = batch;
compose->account = account;
}
}
}
- compose->gtkaspell = gtkaspell;
+ compose->gtkaspell = gtkaspell;
compose_spell_menu_changed(compose);
claws_spell_entry_set_gtkaspell(CLAWS_SPELL_ENTRY(subject_entry), gtkaspell);
#endif
g_free(ainfo->file);
g_free(ainfo->content_type);
g_free(ainfo->name);
+ g_free(ainfo->charset);
g_free(ainfo);
}
COL_MIMETYPE, ainfo->content_type,
COL_SIZE, text,
COL_NAME, ainfo->name,
+ COL_CHARSET, ainfo->charset,
-1);
break;
for ( tmp = file_list; tmp; tmp = tmp->next) {
gchar *file = (gchar *) tmp->data;
gchar *utf8_filename = conv_filename_to_utf8(file);
- compose_attach_append(compose, file, utf8_filename, NULL);
+ compose_attach_append(compose, file, utf8_filename, NULL, NULL);
compose_changed_cb(NULL, compose);
if (free_data) {
g_free(file);
gchar *utf8_filename = conv_filename_to_utf8((const gchar *)tmp->data);
compose_attach_append
(compose, (const gchar *)tmp->data,
- utf8_filename, NULL);
+ utf8_filename, NULL, NULL);
g_free(utf8_filename);
}
if (list) compose_changed_cb(NULL, compose);
TRUE, TRUE);
if (file) {
compose_attach_append(compose, (const gchar *)file,
- (const gchar *)file, "message/rfc822");
+ (const gchar *)file, "message/rfc822", NULL);
g_free(file);
}
}