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
Commits
485440f1
Commit
485440f1
authored
May 26, 2021
by
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
Changes
1
Pipelines
3
Hide 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)
...
@@ -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
;
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
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)"
)
,
319
},
{
"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>"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment