Skip to content
Snippets Groups Projects
Commit 485440f1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

New bbs.view_file(filename) method.

To list/view file/archive contents.
parent 8cd6ca9c
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2317 passed
......@@ -2145,6 +2145,34 @@ js_batchaddlist(JSContext *cx, uintN argc, jsval *arglist)
return(JS_TRUE);
}
static JSBool
js_viewfile(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
sbbs_t* sbbs;
jsrefcount rc;
char* cstr;
if((sbbs = js_GetPrivate(cx, JS_THIS_OBJECT(cx, arglist))) == NULL)
return JS_FALSE;
JS_SET_RVAL(cx, arglist, JSVAL_VOID);
if(!js_argc(cx, argc, 1))
return JS_FALSE;
JSVALUE_TO_MSTRING(cx, argv[0], cstr, NULL);
if(cstr == NULL)
return JS_FALSE;
rc=JS_SUSPENDREQUEST(cx);
JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(sbbs->viewfile(cstr)));
free(cstr);
JS_RESUMEREQUEST(cx, rc);
return JS_TRUE;
}
static JSBool
js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
{
......@@ -4319,6 +4347,10 @@ static jsSyncMethodSpec js_bbs_functions[] = {
,JSDOCSTR("add file list to batch download queue")
,310
},
{"view_file", js_viewfile, 1, JSTYPE_BOOLEAN, JSDOCSTR("filename")
,JSDOCSTR("list contents of specified filename (complete path)")
,319
},
{"send_file", js_sendfile, 1, JSTYPE_BOOLEAN, JSDOCSTR("filename [,protocol] [,description] [,autohang=true]")
,JSDOCSTR("send specified filename (complete path) to user via user-prompted "
"(or optionally specified) protocol.<br>"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment