#ifndef HYBBX_MONITOR_H #define HYBBX_MONITOR_H #include "hybbx/limits.h" #include "hybbx/types.h" #ifdef __cplusplus extern "C" { #endif struct hybbx_config; struct hybbx_service; struct hybbx_session; #define HYBBX_MONITOR_ALLOW_MAX 16u #define HYBBX_MONITOR_ALLOW_NAME_MAX 64u typedef struct hybbx_monitor_config { int enabled; int follow_hybbx; int follow_security; /** When set, Sysop sessions are always hidden from /who and /online. */ int invisible_sysop; unsigned invite_timeout_sec; char allow[HYBBX_MONITOR_ALLOW_MAX][HYBBX_MONITOR_ALLOW_NAME_MAX]; unsigned allow_count; } hybbx_monitor_config_t; void hybbx_monitor_config_defaults(hybbx_monitor_config_t *cfg); void hybbx_monitor_config_apply(const struct hybbx_config *config); const hybbx_monitor_config_t *hybbx_monitor_config_get(void); /** Non-zero when [monitor] enabled=yes. */ int hybbx_monitor_enabled(void); /** Non-zero when [monitor] invisible-sysop=yes (Sysop always /who-hidden). */ int hybbx_monitor_invisible_sysop(void); /** Non-zero when @p username is listed in [monitor] allow=. */ int hybbx_monitor_user_allowed(const char *username); /** * Non-zero when @p session may use /monitor (Sysop/registry OR allow list). * Caller still runs normal command access for registry min-level. */ int hybbx_monitor_session_may_use(const struct hybbx_session *session); /** Enable/disable monitor mode on @p session. */ hybbx_result_t hybbx_monitor_set_active(struct hybbx_session *session, int on); int hybbx_monitor_is_active(const struct hybbx_session *session); /** * Push a live line to every session with monitor mode on. * Prefixes with "[monitor] " for clarity. */ void hybbx_monitor_broadcast(struct hybbx_service *service, const char *line); /** Format Username@plugin event and push live (always when any monitor on). */ void hybbx_monitor_event(struct hybbx_service *service, const char *username, const char *plugin, const char *detail); /** Poll log file tails (call from service loop). */ void hybbx_monitor_tick(struct hybbx_service *service); void hybbx_monitor_shutdown(void); #ifdef __cplusplus } #endif #endif /* HYBBX_MONITOR_H */