Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Compare Revisions
8cd6ca9c7216f5b94b55886403717de94edd01ea...485440f1ea548f7362b26dbcf82a6e702ccc5f98
Commits (1)
New bbs.view_file(filename) method.
· 485440f1
Rob Swindell
authored
May 26, 2021
To list/view file/archive contents.
485440f1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
src/sbbs3/js_bbs.cpp
src/sbbs3/js_bbs.cpp
+32
-0
No files found.
src/sbbs3/js_bbs.cpp
View file @
485440f1
...
...
@@ -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>"
...
...