From e1730d8012fca0a712de588285342f7ad10dd804 Mon Sep 17 00:00:00 2001 From: "info@mode42.com" Date: Sun, 9 Aug 2026 12:22:53 +0000 Subject: now including entertain/chess --- src/core/command.c | 19 ++++++++++++++----- src/core/instance.c | 23 +++++++++++++++++++---- src/core/networks.c | 15 +++++++++++++-- src/core/service.c | 12 +++++------- 4 files changed, 51 insertions(+), 18 deletions(-) (limited to 'src/core') diff --git a/src/core/command.c b/src/core/command.c index 3614821..44485c7 100644 --- a/src/core/command.c +++ b/src/core/command.c @@ -2160,11 +2160,19 @@ static void monitor_list_visitor(hybbx_session_t *session, void *userdata) static void monitor_show_cmds(hybbx_session_t *session) { - hybbx_session_write_line(session, "Monitor admin commands:"); + hybbx_session_write_line(session, "Monitor:"); hybbx_session_write_line(session, - " /monitor meet [force] — conference invite (20s) or force"); + " /monitor on|off — start/stop live log follow"); hybbx_session_write_line(session, - "Run any of these as normal /verb (stay invisible while Sysop hidden):"); + " /monitor list — status + visible online users"); + hybbx_session_write_line(session, + " /monitor meet [force] — conference invite (or force)"); + hybbx_session_write_line(session, + " /monitor cmds — this menu + Sysop verbs"); + hybbx_session_write_line(session, + "While monitor is on (or invisible-sysop=yes), Sysop stays hidden from /who."); + hybbx_session_write_line(session, + "Sysop verbs (use as normal /verb):"); hybbx_commands_registry_show_sysop_cmds(session); } @@ -2199,7 +2207,8 @@ static hybbx_result_t cmd_monitor(hybbx_service_t *service, return hybbx_monitor_set_active(session, 0); } - if (str_ieq(sub, "cmd") || str_ieq(sub, "cmds") || str_ieq(sub, "commands")) { + if (str_ieq(sub, "cmd") || str_ieq(sub, "cmds") || str_ieq(sub, "commands") || + str_ieq(sub, "help") || str_ieq(sub, "?")) { monitor_show_cmds(session); return HYBBX_OK; } @@ -2227,7 +2236,7 @@ static hybbx_result_t cmd_monitor(hybbx_service_t *service, if (!str_ieq(sub, "list") && cmd->argc >= 1) { hybbx_session_write_line(session, - "Usage: /monitor on|off|list|cmds|meet [force]"); + "Usage: /monitor on|off|list|cmds|meet [force] — /help monitor"); return HYBBX_ERR_INVALID; } diff --git a/src/core/instance.c b/src/core/instance.c index 4640678..0b9f717 100644 --- a/src/core/instance.c +++ b/src/core/instance.c @@ -108,6 +108,11 @@ int hybbx_instance_plugin_allowed(const char *plugin_name) return role != HYBBX_INSTANCE_MAIN; } + /* Entertain (chess, …) is Main / standalone Main only. */ + if (str_ieq(plugin_name, "entertain")) { + return role == HYBBX_INSTANCE_MAIN; + } + switch (role) { case HYBBX_INSTANCE_MAIN: if (str_ieq(plugin_name, "baycom") || @@ -155,7 +160,7 @@ hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks hybbx_instance_binary_name()); hybbx_log_info("[instance] binary=%s role=%s standalone=yes user_bbx=%s " "telnet=%s ssh=%s ax25=%s baycom=%s ardop=%s crdop=%s " - "websocket=%s circuit=%s mains_proxy=%s", + "websocket=%s circuit=%s mains_proxy=%s entertain=%s", hybbx_instance_binary_name(), hybbx_instance_role_name(), hybbx_instance_offers_user_bbx() ? "yes" : "no", @@ -167,7 +172,8 @@ hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks hybbx_bool_to_string(networks->crdop), hybbx_bool_to_string(networks->websocket), hybbx_bool_to_string(networks->circuit), - hybbx_bool_to_string(networks->mains_proxy)); + hybbx_bool_to_string(networks->mains_proxy), + hybbx_bool_to_string(networks->entertain)); return HYBBX_OK; } @@ -212,6 +218,10 @@ hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks break; case HYBBX_INSTANCE_SECONDARY: + if (networks->entertain) { + hybbx_log_warn("[instance] hybbxsd: entertain Main-only — forcing off"); + networks->entertain = 0; + } if (networks->telnet) { hybbx_log_warn("[instance] hybbxsd: no user telnet — forcing off"); networks->telnet = 0; @@ -233,6 +243,10 @@ hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks break; case HYBBX_INSTANCE_PROXY: + if (networks->entertain) { + hybbx_log_warn("[instance] hybbxpd: entertain Main-only — forcing off"); + networks->entertain = 0; + } if (networks->websocket) { hybbx_log_warn("[instance] hybbxpd: WebSocket forbidden — forcing off"); networks->websocket = 0; @@ -254,7 +268,7 @@ hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks hybbx_log_info("[instance] binary=%s role=%s user_bbx=%s " "telnet=%s ssh=%s ax25=%s baycom=%s ardop=%s crdop=%s " - "websocket=%s circuit=%s mains_proxy=%s", + "websocket=%s circuit=%s mains_proxy=%s entertain=%s", hybbx_instance_binary_name(), hybbx_instance_role_name(), hybbx_instance_offers_user_bbx() ? "yes" : "no", @@ -266,7 +280,8 @@ hybbx_result_t hybbx_networks_enforce_instance(hybbx_networks_config_t *networks hybbx_bool_to_string(networks->crdop), hybbx_bool_to_string(networks->websocket), hybbx_bool_to_string(networks->circuit), - hybbx_bool_to_string(networks->mains_proxy)); + hybbx_bool_to_string(networks->mains_proxy), + hybbx_bool_to_string(networks->entertain)); return HYBBX_OK; } diff --git a/src/core/networks.c b/src/core/networks.c index c52554d..f61479e 100644 --- a/src/core/networks.c +++ b/src/core/networks.c @@ -54,6 +54,7 @@ void hybbx_networks_config_defaults(hybbx_networks_config_t *networks) networks->websocket = 0; networks->circuit = 1; networks->mains_proxy = 0; + networks->entertain = 0; } void hybbx_networks_config_apply(hybbx_networks_config_t *networks, @@ -106,8 +107,13 @@ void hybbx_networks_config_apply(hybbx_networks_config_t *networks, "mains_proxy", 0); } + if (networks_has_key(config, "entertain")) { + networks->entertain = hybbx_config_get_bool(config, "networks", + "entertain", 0); + } + hybbx_log_info("[networks] telnet=%s ssh=%s ax25=%s baycom=%s ardop=%s " - "crdop=%s websocket=%s circuit=%s mains_proxy=%s", + "crdop=%s websocket=%s circuit=%s mains_proxy=%s entertain=%s", hybbx_bool_to_string(networks->telnet), hybbx_bool_to_string(networks->ssh), hybbx_bool_to_string(networks->ax25), @@ -116,7 +122,8 @@ void hybbx_networks_config_apply(hybbx_networks_config_t *networks, hybbx_bool_to_string(networks->crdop), hybbx_bool_to_string(networks->websocket), hybbx_bool_to_string(networks->circuit), - hybbx_bool_to_string(networks->mains_proxy)); + hybbx_bool_to_string(networks->mains_proxy), + hybbx_bool_to_string(networks->entertain)); } int hybbx_networks_is_static_transport(const char *plugin_name) @@ -187,5 +194,9 @@ int hybbx_networks_transport_wanted(const char *plugin_name, return networks->mains_proxy; } + if (str_ieq(plugin_name, "entertain")) { + return networks->entertain; + } + return 0; } diff --git a/src/core/service.c b/src/core/service.c index 20934a7..dda6311 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -918,11 +918,8 @@ hybbx_result_t hybbx_service_start_transport(hybbx_service_t *service, return HYBBX_ERR_BUSY; } - if (active->plugin->start == NULL) { - return HYBBX_ERR_UNSUPPORTED; - } - - { + /* Feature plugins (e.g. entertain) may have init/tick/on_command only. */ + if (active->plugin->start != NULL) { hybbx_result_t rc = active->plugin->start(config); if (rc != HYBBX_OK) { return rc; @@ -1040,8 +1037,9 @@ hybbx_result_t hybbx_service_try_plugin_command(hybbx_service_t *service, const hybbx_transport_plugin_t *p = svc->transports[i].plugin; if (p != NULL && p->on_command != NULL) { hybbx_result_t rc = p->on_command(service, session, cmd); - if (rc == HYBBX_OK) { - return HYBBX_OK; + /* NOT_FOUND = not this plugin; any other result = handled. */ + if (rc != HYBBX_ERR_NOT_FOUND) { + return rc; } } } -- cgit v1.3.1