Commit e59866e3 authored by Rob Swindell's avatar Rob Swindell

Better sysop availability (for chat) visibility/toggleability

- JS system.operator_available property (read/writeable)
- SYSAVAIL @-code which expands to LiSysopAvailable or LiSysopNotAvailable
  (use the new SYSAVAIL @-code in the chat menu to show availabilty to chat)
- ;avail sysop command (in str_cmds.js) to toggle sysop availability
- Changed LiSysopIs text.dat string to be a format string (include %s) and
  the trailing \r\n, so that it can be used in str_cmds.js or anywhere else
  to report sysop availability to chat, or can be set to blank string to
  display nothing (this would not work previously).
parent c1136cdd
Pipeline #158 passed with stage
in 9 minutes and 21 seconds
......@@ -423,7 +423,7 @@
"\1bLogons Today : \1c%-5u \1b(Max \1c%u\1b)\r\n" 352 LiLogonsToday
"\1bTime on Today : \1c%-5u \1b(Max \1c%u\1b)\r\n" 353 LiTimeonToday
"\1bMail Waiting : \1c%u\r\n" 354 LiMailWaiting
"\1bSysop is : \1c" 355 LiSysopIs
"\1b\1hSysop is : \1c%s\r\n" 355 LiSysopIs
"Available" 356 LiSysopAvailable
"Not Available" 357 LiSysopNotAvailable
"\1r\1h\1iYou can't possibly be in two places at the "\ 358 UserOnTwoNodes
......
......@@ -456,6 +456,9 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen, long* pmode, bool
if(!strcmp(sp,"SYSOP"))
return(cfg.sys_op);
if(strcmp(sp, "SYSAVAIL") == 0)
return text[sysop_available(&cfg) ? LiSysopAvailable : LiSysopNotAvailable];
if(!strcmp(sp,"LOCATION"))
return(cfg.sys_location);
......
......@@ -51,6 +51,7 @@ extern JSClass js_system_class;
enum {
SYS_PROP_NAME
,SYS_PROP_OP
,SYS_PROP_OP_AVAIL
,SYS_PROP_ID
,SYS_PROP_MISC
,SYS_PROP_INETADDR
......@@ -146,6 +147,9 @@ static JSBool js_system_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
case SYS_PROP_OP:
p=cfg->sys_op;
break;
case SYS_PROP_OP_AVAIL:
*vp=BOOLEAN_TO_JSVAL(sysop_available(cfg));
break;
case SYS_PROP_ID:
p=cfg->sys_id;
break;
......@@ -359,10 +363,16 @@ static JSBool js_system_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict
case SYS_PROP_MISC:
JS_ValueToInt32(cx, *vp, &sys->cfg->sys_misc);
break;
case SYS_PROP_OP_AVAIL:
if(!set_sysop_availability(sys->cfg, JSVAL_TO_BOOLEAN(*vp))) {
JS_ReportError(cx, "%s: Failed to set sysop availability", __FUNCTION__);
return JS_FALSE;
}
break;
}
#endif
return(TRUE);
return JS_TRUE;
}
......@@ -374,6 +384,7 @@ static jsSyncPropertySpec js_system_properties[] = {
#ifndef JSDOOR
{ "name", SYS_PROP_NAME, SYSOBJ_FLAGS, 310 },
{ "operator", SYS_PROP_OP, SYSOBJ_FLAGS, 310 },
{ "operator_available", SYS_PROP_OP_AVAIL, JSPROP_ENUMERATE, 31801 },
{ "qwk_id", SYS_PROP_ID, SYSOBJ_FLAGS, 310 },
{ "settings", SYS_PROP_MISC, JSPROP_ENUMERATE, 310 },
{ "inetaddr", SYS_PROP_INETADDR, JSPROP_READONLY, 310 }, /* alias */
......@@ -452,6 +463,7 @@ static jsSyncPropertySpec js_system_properties[] = {
static char* sys_prop_desc[] = {
"BBS name"
,"operator name"
,"operator is available for chat"
,"system QWK-ID (for QWK packets)"
,"settings bitfield (see <tt>SYS_*</tt> in <tt>sbbsdefs.js</tt> for bit definitions)"
,"Internet address (host or domain name)"
......
......@@ -467,8 +467,9 @@ bool sbbs_t::logon()
bprintf(text[LiTimeonToday],useron.ttoday
,cfg.level_timeperday[useron.level]+useron.min);
bprintf(text[LiMailWaiting],mailw);
bprintf("%s%s\r\n\r\n", text[LiSysopIs]
bprintf(text[LiSysopIs]
, text[sysop_available(&cfg) ? LiSysopAvailable : LiSysopNotAvailable]);
newline();
}
if(sys_status&SS_EVENT)
......
......@@ -576,7 +576,7 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x62\x54\x69\x6d\x65\x20\x6f\x6e\x20\x54\x6f\x64\x61\x79\x20\x20\x20\x3a\x20\x01\x63\x25\x2d\x35\x75\x20\x01\x62\x28\x4d\x61"
"\x78\x20\x01\x63\x25\x75\x01\x62\x29\x0d\x0a" // 353 LiTimeonToday
,"\x01\x62\x4d\x61\x69\x6c\x20\x57\x61\x69\x74\x69\x6e\x67\x20\x20\x20\x20\x3a\x20\x01\x63\x25\x75\x0d\x0a" // 354 LiMailWaiting
,"\x01\x62\x53\x79\x73\x6f\x70\x20\x69\x73\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x01\x63" // 355 LiSysopIs
,"\x01\x62\x01\x68\x53\x79\x73\x6f\x70\x20\x69\x73\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x01\x63\x25\x73\x0d\x0a" // 355 LiSysopIs
,"\x41\x76\x61\x69\x6c\x61\x62\x6c\x65" // 356 LiSysopAvailable
,"\x4e\x6f\x74\x20\x41\x76\x61\x69\x6c\x61\x62\x6c\x65" // 357 LiSysopNotAvailable
,"\x01\x72\x01\x68\x01\x69\x59\x6f\x75\x20\x63\x61\x6e\x27\x74\x20\x70\x6f\x73\x73\x69\x62\x6c\x79\x20\x62\x65\x20\x69\x6e\x20\x74"
......
......@@ -5,7 +5,7 @@
4 HWJoin a Chat NB
HCJY NCJoin/initiate multinode chatWB
HCPNC Join/start private node/node chatG B
HCCY NCChat with @SYSOP-L##############@G B
HCCY NCChat with Sysop: HY@SYSAVAIL-L####@NG B
HCTY NCTalk with The Guru (AI)WB
HCFY NCFinger (query) remote user/systemW B
HCRY NCInternet Relay Chat (IRC)WB
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment