0.2.0: keep all chat, @ staff chat and SimpleAdmin's say commands too

wh_messages now holds every message with a channel (all, team, pm, staff,
to_staff, css_say/asay/psay/csay/hsay/cssay) and NULL sender columns for
the console. Seen by a catch-all listener added in Load, which CSS runs
before CS2-SimpleAdmin's (added in OnAllPluginsLoaded), so gagged lines and
@ chat are kept before SimpleAdmin stops or rewrites them. Replaces
001_CreateTables in place: drop wh_messages and wh_migrations first.
This commit is contained in:
Astra 2026-10-05 14:57:19 +01:00
parent c414e8a770
commit 06823c2d47
5 changed files with 146 additions and 29 deletions

View file

@ -1,30 +1,38 @@
-- Whisper's tables, in CS2-SimpleAdmin's database. Applied once at load, tracked in wh_migrations.
-- All times are UTC.
-- One row per private message attempt, sent or not (while History is on in Whisper.json).
-- result: sent, blocked, gagged, cooldown, no_target, ambiguous, group_target, too_long.
-- The recipient columns are NULL when no single player was found. team: 0 none, 1 spectator,
-- 2 T, 3 CT. alive: 1 when on T/CT with a living pawn. target is what the sender typed for it.
-- Every chat message, private message and staff message (while History is on in Whisper.json).
-- channel: all, team (normal chat), pm (/pm and /r), staff (@ team chat from staff), to_staff
-- (@ team chat from a player), or the SimpleAdmin command used: css_say, css_asay, css_psay,
-- css_csay, css_hsay, css_cssay.
-- result: sent; gagged (blocked by a gag or silence); command (a ! or / chat command); and for pm,
-- blocked, cooldown, too_long, no_target, ambiguous or group_target. Staff commands are logged
-- as typed, so one the sender wasn't allowed to use is still "sent".
-- The sender columns are NULL for the server console (RCON, the web panel). The recipient columns
-- are for pm only, NULL when no single player was found. team: 0 none, 1 spectator, 2 T, 3 CT.
-- alive: 1 when on T/CT with a living pawn. target is what the sender typed for it (pm, css_psay).
CREATE TABLE IF NOT EXISTS `wh_messages` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`message_key` char(32) NOT NULL,
`sent_at` datetime NOT NULL,
`server_id` int NULL,
`map` varchar(64) NOT NULL,
`sender_steamid64` bigint unsigned NOT NULL,
`channel` varchar(16) NOT NULL,
`sender_steamid64` bigint unsigned NULL,
`sender_name` varchar(128) NOT NULL,
`sender_team` tinyint NOT NULL,
`sender_alive` tinyint NOT NULL,
`sender_team` tinyint NULL,
`sender_alive` tinyint NULL,
`recipient_steamid64` bigint unsigned NULL,
`recipient_name` varchar(128) NULL,
`recipient_team` tinyint NULL,
`recipient_alive` tinyint NULL,
`target` varchar(128) NOT NULL,
`target` varchar(128) NULL,
`message` varchar(512) NOT NULL,
`result` varchar(16) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_message_key` (`message_key`),
KEY `ix_sent_at` (`sent_at`),
KEY `ix_channel` (`channel`, `sent_at`),
KEY `ix_sender` (`sender_steamid64`, `sent_at`),
KEY `ix_recipient` (`recipient_steamid64`, `sent_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;