Commit 485440f1 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

New bbs.view_file(filename) method.

To list/view file/archive contents.
parent 8cd6ca9c
Pipeline #2317 passed with stage
in 9 minutes and 22 seconds
...@@ -2145,6 +2145,34 @@ js_batchaddlist(JSContext *cx, uintN argc, jsval *arglist) ...@@ -2145,6 +2145,34 @@ js_batchaddlist(JSContext *cx, uintN argc, jsval *arglist)
return(JS_TRUE); 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;
JS_SET_RVAL(cx, arglist, BOOLEAN_TO_JSVAL(sbbs->viewfile(cstr)));
return JS_TRUE;
static JSBool static JSBool
js_sendfile(JSContext *cx, uintN argc, jsval *arglist) js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
{ {
...@@ -4319,6 +4347,10 @@ static jsSyncMethodSpec js_bbs_functions[] = { ...@@ -4319,6 +4347,10 @@ static jsSyncMethodSpec js_bbs_functions[] = {
,JSDOCSTR("add file list to batch download queue") ,JSDOCSTR("add file list to batch download queue")
,310 ,310
}, },
{"view_file", js_viewfile, 1, JSTYPE_BOOLEAN, JSDOCSTR("filename")
,JSDOCSTR("list contents of specified filename (complete path)")
{"send_file", js_sendfile, 1, JSTYPE_BOOLEAN, JSDOCSTR("filename [,protocol] [,description] [,autohang=true]") {"send_file", js_sendfile, 1, JSTYPE_BOOLEAN, JSDOCSTR("filename [,protocol] [,description] [,autohang=true]")
,JSDOCSTR("send specified filename (complete path) to user via user-prompted " ,JSDOCSTR("send specified filename (complete path) to user via user-prompted "
"(or optionally specified) protocol.<br>" "(or optionally specified) protocol.<br>"
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