...
 
Commits (3)
......@@ -3,7 +3,7 @@
require("utf8_ascii.js", 'utf8_ascii');
require("smbdefs.js", 'RFC822HEADER');
MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold)
MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold, default_content_type)
{
var content_type;
var i;
......@@ -17,7 +17,8 @@ MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold)
if(this.cc_list)
this.rfc822 += "Cc: " + this.cc_list + "\r\n";
this.rfc822 += "Subject: "+this.subject+"\r\n";
this.rfc822 += "Message-ID: "+this.id+"\r\n";
if(this.id)
this.rfc822 += "Message-ID: "+this.id+"\r\n";
this.rfc822 += "Date: "+this.date+"\r\n";
var quoted_from = '"' + this.from + '"';
......@@ -105,7 +106,7 @@ MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold)
this.rfc822 += this.field_list[i].data+"\r\n";
}
}
if(content_type==undefined) {
if(content_type==undefined && default_content_type !== false) {
var charset = this.text_charset || (this.is_utf8 ? "UTF-8" : "IBM437");
this.rfc822 += "Content-Type: text/plain; charset=" + charset + "\r\n";
this.rfc822 += "Content-Transfer-Encoding: 8bit\r\n";
......
......@@ -660,7 +660,7 @@ function mail_reply(msg, reply_all)
}
}
function download_msg_source(msg)
function download_msg(msg, plain_text)
{
var fname = system.temp_dir + "msg_" + msg.number + ".txt";
var f = new File(fname);
......@@ -670,8 +670,9 @@ function download_msg_source(msg)
,/* strip ctrl-a */false
,/* dot-stuffing */false
,/* tails */true
,/* plain-text */false);
f.write(msg.get_rfc822_header(/* force_update: */false, /* unfold: */false));
,plain_text);
f.write(msg.get_rfc822_header(/* force_update: */false, /* unfold: */false
,/* default_content_type */!plain_text));
f.writeln(text);
f.close();
return bbs.send_file(fname);
......@@ -1046,8 +1047,8 @@ function list_msgs(msgbase, list, current, preview, grp_name, sub_name)
break;
case 'D':
console.clearline();
if(!console.noyes("Download message source", P_NOCRLF)) {
if(!download_msg_source(list[current], msgbase))
if(!console.noyes("Download message", P_NOCRLF)) {
if(!download_msg(list[current], msgbase, console.yesno("Plain-text only")))
alert("failed");
}
console.creturn();
......@@ -1124,8 +1125,8 @@ function list_msgs(msgbase, list, current, preview, grp_name, sub_name)
break;
case 'D':
console.clearline();
if(!console.noyes("Download message source", P_NOCRLF)) {
if(!download_msg_source(list[current], msgbase))
if(!console.noyes("Download message", P_NOCRLF)) {
if(!download_msg(list[current], msgbase, console.yesno("Plain-text only")))
alert("failed");
continue;
}
......