Skip to content
Snippets Groups Projects
Commit c22c0698 authored by rswindell's avatar rswindell
Browse files

Added bbs.get_time_left() method - I can't believe there wasn't any method that

called sbbs_t::gettimeleft() directly before now. <sigh>
The irc.js needed this to disconnect users when their time runs out.
parent 401bf00f
Branches
Tags
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -2594,6 +2594,19 @@ js_select_editor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r ...@@ -2594,6 +2594,19 @@ js_select_editor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
return(JS_TRUE); return(JS_TRUE);
} }
static JSBool
js_get_time_left(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
sbbs_t* sbbs;
if((sbbs=(sbbs_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
sbbs->gettimeleft();
*rval = INT_TO_JSVAL(sbbs->timeleft);
return(JS_TRUE);
}
static jsSyncMethodSpec js_bbs_functions[] = { static jsSyncMethodSpec js_bbs_functions[] = {
{"atcode", js_atcode, 1, JSTYPE_STRING, JSDOCSTR("code_string") {"atcode", js_atcode, 1, JSTYPE_STRING, JSDOCSTR("code_string")
,JSDOCSTR("returns @-code value, specified <i>code</i> string does not include @ character delimiters") ,JSDOCSTR("returns @-code value, specified <i>code</i> string does not include @ character delimiters")
...@@ -2951,6 +2964,10 @@ static jsSyncMethodSpec js_bbs_functions[] = { ...@@ -2951,6 +2964,10 @@ static jsSyncMethodSpec js_bbs_functions[] = {
,JSDOCSTR("prompt user to select a new external message editor") ,JSDOCSTR("prompt user to select a new external message editor")
,310 ,310
}, },
{"get_time_left", js_get_time_left, 0, JSTYPE_NUMBER, JSDOCSTR("")
,JSDOCSTR("check the user's time left and return the value, in seconds")
,31401
},
{0} {0}
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment