diff --git a/src/sbbs3/js_bbs.cpp b/src/sbbs3/js_bbs.cpp index 2d5c312d48f8bb5b54dac57f0f63637e7ab836fe..4dc3a2b31a9997eb41f47b51b9ed1956caf16d58 100644 --- a/src/sbbs3/js_bbs.cpp +++ b/src/sbbs3/js_bbs.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @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 * * 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 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[] = { {"atcode", js_atcode, 1, JSTYPE_STRING, JSDOCSTR("code_string") ,JSDOCSTR("returns @-code value, specified <i>code</i> string does not include @ character delimiters") @@ -2951,6 +2964,10 @@ static jsSyncMethodSpec js_bbs_functions[] = { ,JSDOCSTR("prompt user to select a new external message editor") ,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} };