Commit 284b31b3 authored by rswindell's avatar rswindell
Browse files

smb_getplaintext and smb_getmsgtxt(...,GETMSGTXT_PLAIN) will now fall-back

to a text/html part of a multi-part MIME encoded message if no text/plain part
exists.
Changed smbmsg_t.charset to smbmsg_t.text_charset.
Added smbmsg_t.text_subtype (e.g. "plain" or "html").
Fixed issue with parsing parsed plain-text when the charset was the last
element of the MIME-part header.
MIMEDecodedPlainTextFmt text.dat line now includes the text sub-type arg
parent 41edfbbc
......@@ -280,7 +280,9 @@ bool sbbs_t::show_msg(smb_t* smb, smbmsg_t* msg, long p_mode, post_t* post)
if(p == NULL)
p = txt;
else
bprintf(text[MIMEDecodedPlainTextFmt], msg->charset == NULL ? "US-ASCII" : msg->charset);
bprintf(text[MIMEDecodedPlainTextFmt]
, msg->text_charset == NULL ? "unspecified (US-ASCII)" : msg->text_charset
, msg->text_subtype);
}
truncsp(p);
SKIP_CRLF(p);
......
......@@ -1388,7 +1388,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id)
LAZY_UINTEGER_EXPAND("columns", p->msg.columns, JSPROP_ENUMERATE);
LAZY_STRING_TRUNCSP_NULL("mime_version", p->msg.mime_version, JSPROP_ENUMERATE|JSPROP_READONLY);
LAZY_STRING_TRUNCSP_NULL("content_type", p->msg.content_type, JSPROP_ENUMERATE|JSPROP_READONLY);
LAZY_STRING_TRUNCSP_NULL("charset", p->msg.charset, JSPROP_ENUMERATE|JSPROP_READONLY);
LAZY_STRING_TRUNCSP_NULL("text_charset", p->msg.text_charset, JSPROP_ENUMERATE|JSPROP_READONLY);
LAZY_STRING_TRUNCSP_NULL("text_subtype", p->msg.text_subtype, JSPROP_ENUMERATE|JSPROP_READONLY);
/* Fixed length portion of msg header */
LAZY_UINTEGER("type", p->msg.hdr.type, JSPROP_ENUMERATE);
......@@ -3026,7 +3027,7 @@ static jsSyncMethodSpec js_msgbase_functions[] = {
"The <i>by_offfset</i> (<tt>true</tt>) argument should only be passed when the argument following it is the numeric index-offset of the message to be "
"retrieved. By default (<i>by_offset</i>=<tt>false</tt>), a numeric argument would be interpreted as the message <i>number</i> to be retrieved."
"<br>"
"After reading/parsing MIME plain-text, a new <i>charset</i> header property (string) may be available to reflect the content-type 'charset' value."
"After reading a multi-part MIME-encoded message, new header properties may be available: <i>text_charset</i> and <i>text_subtype</i>."
)
,310
},
......@@ -3101,7 +3102,6 @@ static jsSyncMethodSpec js_msgbase_functions[] = {
"<tr><td align=top><tt>replyto_list</tt><td>Comma-separated list of mailboxes to reply-to, RFC822-style"
"<tr><td align=top><tt>mime-version</tt><td>MIME Version (optional)"
"<tr><td align=top><tt>content-type</tt><td>MIME Content-Type (optional)"
"<tr><td align=top><tt>charset</tt><td>MIME plain-text charset value (optional)"
"<tr><td align=top><tt>summary</tt><td>Message Summary (optional)"
"<tr><td align=top><tt>tags</tt><td>Message Tags (space-delimited, optional)"
"<tr><td align=top><tt>id</tt><td>Message's RFC-822 compliant Message-ID"
......
......@@ -1314,8 +1314,8 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x01\x77" // 795 SPAMVisibilityIsNow
,"\x0d\x0a\x54\x6f\x20\x76\x6f\x74\x65\x20\x69\x6e\x20\x74\x68\x69\x73\x20\x70\x6f\x6c\x6c\x2c\x20\x68\x69\x74\x20\x7e\x56\x20\x6e"
"\x6f\x77\x2e\x0d\x0a" // 796 VoteInThisPollNow
,"\x01\x6e\x01\x6d\x4d\x49\x4d\x45\x2d\x64\x65\x63\x6f\x64\x65\x64\x20\x25\x73\x20\x70\x6c\x61\x69\x6e\x2d\x74\x65\x78\x74\x3a\x01"
"\x6e\x0d\x0a" // 797 MIMEDecodedPlainTextFmt
,"\x01\x6e\x01\x6d\x4d\x49\x4d\x45\x2d\x64\x65\x63\x6f\x64\x65\x64\x20\x25\x73\x20\x25\x73\x2d\x74\x65\x78\x74\x3a\x01\x6e\x0d\x0a"
"" // 797 MIMEDecodedPlainTextFmt
,"\x01\x2f\x40\x45\x58\x45\x43\x3a\x53\x48\x4f\x57\x4d\x53\x47\x41\x56\x41\x54\x41\x52\x40\x0d\x0a" // 798 MsgHdrBodySeparator
,"\x01\x2f\x0d\x0a\x40\x45\x58\x45\x43\x3a\x53\x48\x4f\x57\x46\x49\x4c\x45\x41\x56\x41\x54\x41\x52\x40" // 799 FileHdrDescSeparator
,"\x52\x65\x6d\x6f\x76\x65\x20\x66\x69\x6c\x65" // 800 RemoveFileQ
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment