Commit 83cd7103 authored by rswindell's avatar rswindell
Browse files

Make the SMB plain-text only feature available to users of the

MsgBase.get_msg_body() method: added an additional boolean argument (following
the 'include_tails' argument), which defaults to false (disabled). Pass true
for this argument to enable this feature. Yes, JS-authors could do this parsing
easily via JS, but I figure so long as this feature is in the SMBLIB, might as
well expose it to JS for consistency (e.g. in 3rd party message reader mods).
parent 27c1357a
......@@ -1829,9 +1829,11 @@ js_get_msg_body(JSContext *cx, uintN argc, jsval *arglist)
uintN n;
smbmsg_t msg;
smbmsg_t *msgptr;
long getmsgtxtmode = 0;
JSBool by_offset=JS_FALSE;
JSBool strip_ctrl_a=JS_FALSE;
JSBool tails=JS_TRUE;
JSBool plain=JS_FALSE;
JSBool rfc822=JS_FALSE;
JSBool msg_specified=JS_FALSE;
JSBool existing_msg=JS_FALSE;
......@@ -1913,8 +1915,17 @@ js_get_msg_body(JSContext *cx, uintN argc, jsval *arglist)
if(n<argc && JSVAL_IS_BOOLEAN(argv[n]))
if(n<argc && JSVAL_IS_BOOLEAN(argv[n]))
getmsgtxtmode |= GETMSGTXT_TAILS;
getmsgtxtmode |= GETMSGTXT_PLAIN;
buf = get_msg_text(p, msgptr, strip_ctrl_a, rfc822, tails ? GETMSGTXT_TAILS : 0, existing_msg);
buf = get_msg_text(p, msgptr, strip_ctrl_a, rfc822, getmsgtxtmode, existing_msg);
......@@ -2385,10 +2396,10 @@ static jsSyncMethodSpec js_msgbase_functions[] = {
{"get_msg_body", js_get_msg_body, 2, JSTYPE_STRING, JSDOCSTR("[by_offset=<tt>false</tt>,] number_or_id [, message_header] [,strip_ctrl_a=<tt>false</tt>] "
"[,rfc822_encoded=<tt>false</tt>] [,include_tails=<tt>true</tt>]")
"[,rfc822_encoded=<tt>false</tt>] [,include_tails=<tt>true</tt>] [,plain_text=<tt>false</tt>]")
,JSDOCSTR("returns the entire body text of a specific message as a single String, <i>null</i> on failure. "
"The default behavior is to leave Ctrl-A codes intact, perform no RFC-822 encoding, and to include tails (if any) in the "
"returned body text."
"returned body text. When <i>plain_text</i> is true, only the first plain-text portion of a multi-part MIME encoded message body is returned."
Supports Markdown
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