blob: a4d8db5c326ba0d5ef354e34ccedd26cd9c69e0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#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 */
|