Skip to content
Snippets Groups Projects
Commit fbf99ab6 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add 'first_node' and 'last_node' properties to JS bbs object

This allows scripts (e.g. login.js) to have custom behavior (e.g. shortening
the maximum inactivity timeout) based on how close the current node is to the
configured last node number. There may be other uses too, but for the vast
majority of Synchronet systems, first_node will always be 1 and last_node the
same as system.nodes/lastnode. Ugh, inconsistent naming. :-(
parent f6a25e4f
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3943 passed
...@@ -41,6 +41,9 @@ enum { ...@@ -41,6 +41,9 @@ enum {
,BBS_PROP_EVENT_TIME ,BBS_PROP_EVENT_TIME
,BBS_PROP_EVENT_CODE ,BBS_PROP_EVENT_CODE
,BBS_PROP_FIRST_NODE
,BBS_PROP_LAST_NODE
,BBS_PROP_NODE_NUM ,BBS_PROP_NODE_NUM
,BBS_PROP_NODE_SETTINGS ,BBS_PROP_NODE_SETTINGS
,BBS_PROP_NODE_STATUS ,BBS_PROP_NODE_STATUS
...@@ -165,6 +168,9 @@ enum { ...@@ -165,6 +168,9 @@ enum {
,"Time of next exclusive event (in <i>time_t</i> format), or 0 if none" ,"Time of next exclusive event (in <i>time_t</i> format), or 0 if none"
,"Internal code of next exclusive event" ,"Internal code of next exclusive event"
,"First node number (of this instance of Synchronet)"
,"Last node number (of this instance of Synchronet)"
,"Current node number" ,"Current node number"
,"Current node settings bitfield (see <tt>NM_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions)" ,"Current node settings bitfield (see <tt>NM_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions)"
,"Current node status value (see <tt>nodedefs.js</tt> for valid values)" ,"Current node status value (see <tt>nodedefs.js</tt> for valid values)"
...@@ -335,6 +341,13 @@ static JSBool js_bbs_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp) ...@@ -335,6 +341,13 @@ static JSBool js_bbs_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
p=sbbs->event_code; p=sbbs->event_code;
break; break;
case BBS_PROP_FIRST_NODE:
val = sbbs->startup->first_node;
break;
case BBS_PROP_LAST_NODE:
val = sbbs->startup->last_node;
break;
case BBS_PROP_NODE_NUM: case BBS_PROP_NODE_NUM:
val=sbbs->cfg.node_num; val=sbbs->cfg.node_num;
break; break;
...@@ -990,6 +1003,8 @@ static jsSyncPropertySpec js_bbs_properties[] = { ...@@ -990,6 +1003,8 @@ static jsSyncPropertySpec js_bbs_properties[] = {
{ "time_left" ,BBS_PROP_TIMELEFT ,PROP_READONLY ,311}, { "time_left" ,BBS_PROP_TIMELEFT ,PROP_READONLY ,311},
{ "event_time" ,BBS_PROP_EVENT_TIME ,PROP_READONLY ,311}, { "event_time" ,BBS_PROP_EVENT_TIME ,PROP_READONLY ,311},
{ "event_code" ,BBS_PROP_EVENT_CODE ,PROP_READONLY ,311}, { "event_code" ,BBS_PROP_EVENT_CODE ,PROP_READONLY ,311},
{ "first_node" ,BBS_PROP_FIRST_NODE ,PROP_READONLY ,320},
{ "last_node" ,BBS_PROP_LAST_NODE ,PROP_READONLY ,320},
{ "node_num" ,BBS_PROP_NODE_NUM ,PROP_READONLY ,310}, { "node_num" ,BBS_PROP_NODE_NUM ,PROP_READONLY ,310},
{ "node_settings" ,BBS_PROP_NODE_SETTINGS ,JSPROP_ENUMERATE ,310}, { "node_settings" ,BBS_PROP_NODE_SETTINGS ,JSPROP_ENUMERATE ,310},
{ "node_status" ,BBS_PROP_NODE_STATUS ,PROP_READONLY ,31700}, { "node_status" ,BBS_PROP_NODE_STATUS ,PROP_READONLY ,31700},
...@@ -4876,7 +4891,7 @@ JSObject* js_CreateBbsObject(JSContext* cx, JSObject* parent) ...@@ -4876,7 +4891,7 @@ JSObject* js_CreateBbsObject(JSContext* cx, JSObject* parent)
#ifdef BUILD_JSDOCS #ifdef BUILD_JSDOCS
js_DescribeSyncObject(cx,mods,"Global repository for 3rd party modifications",312); js_DescribeSyncObject(cx,mods,"Global repository for 3rd party modifications",312);
js_DescribeSyncObject(cx,obj,"Controls the Telnet/SSH/RLogin BBS experience",310); js_DescribeSyncObject(cx,obj,"Controls the Terminal Server (traditional BBS) experience",310);
js_CreateArrayOfStrings(cx, obj, "_property_desc_list", bbs_prop_desc, JSPROP_READONLY); js_CreateArrayOfStrings(cx, obj, "_property_desc_list", bbs_prop_desc, JSPROP_READONLY);
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment