-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Just gonna use this for taking notes.
[Edit:] Initial conclusions after looking through most of the non-cmds ChatModule code, actually ChatModule isn't all that big? Tbh I wonder if it would be possible to pull "Chat" and "Commands" apart into two Modules and then rewrite those separately :widegladeline:
ideas/plans
- I still have that really old chat module rewrite I could revive
- 0x0ade/CelesteNet@main...RedFlames:CelesteNet:chat-module-rewrite
- 2023-07-12: Now has PRs of new commands rewrite
- Chat module: literally just renaming some stuff 0x0ade/CelesteNet#108
- Rewrite chat command argument parser(s) 0x0ade/CelesteNet#109
- Snip want to put an external lock around BroadcastRawCMD calls to prevent ws message race conditions
- include message types to stop classifying by colors
- might as well plan for client-local chatting with this rewrite too
- introduce more fine-grained spam-controls, like to allow rapid "/tp" and "/e" usage
- Make a /tp that doesn't send any session data and just goes to same room in same map (...could possibly be local??)
- make a /del moderation-command and prefix the last N (30ish?) messages in client chat log with numbers that cycle through; actually make range of numbers 2N so that if you want to delete oldest deletable you don't accidentally delete a brand new message? -> And only show these numbers when /del is typed in; actually just use make completion prompts
- should it be possible to fully hide global chat? Must be blocked from participating in it too. Implementation could be linked with a "forced" mode for moderation mutes or something.
- (Fix code duplication in Prevent broadcasting targeted broadcasts to everyone 0x0ade/CelesteNet#113) Maybe ForceSend should be renamed to just be Send and have a boolean parameter with a default value for "forcing", whatever that means (Version increment and Action invoke thingy)
Thoughts about breaking changes:
I'm wondering if we'll need to keep some minimal implementations of "legacy" (i.e. current) chat message structures around. For when new clients might be connected to old servers and still need to at least accept old chat messages?
And new server chat should probably still at the very least detect old style clients and send them motd or an upgrade notice 🤷
Idk how a chat "protocol" upgrade would go down
Existing ChatModule etc.
related DataTypes
DataChat
- fields:
- DataPlayerInfo? Player
uintID =0xffffffbyteVersion =0stringTag =""stringText =""ColorColor =Color.White- DateTime Date =
DateTime.UtcNow - DateTime ReceivedDate =
DateTime.UtcNow
- Written to transport:
- (OptRef) Player
- (
uint) Version & ID packed into one value - (
string) Tag - (
string) Text - (
Color, 3 bytes) Color - (
Datein binary = 64-bit integer) Date
- Read of the DataType sets
CreatedByServer = falseandReceivedDate = DateTime.UtcNow - Filters on Handle & Send for dropping when
Text.IsNullOrEmpty() - Server-only fields:
boolCreatedByServerDataPlayerInfo[]?TargetsDataPlayerInfo?Target (is a property based on Targets)
Where does DataChat show up
- ChatModule:
Handle( ... DataEmote)creates a DataChat purely for the PrepareAndLog, logging emotesBroadcast(...)as called by/bcin-game andchat/chatxwscmd's, plus join/leave messages if enabledSendTo(...)as called by- ChatCMDEnv.Send used to send all the command server responses
- MOTD, Spam-error, WSCMDDissolve
- passed into
PrepareAndLogby running/cc,/gcand/w(=/r)
- FrontendModule:
- ...
- Client:
- ...
DataCommandList
- ...
ChatModule
Pretty small besides the Command stuff
ChatModule methods
Init()- instantiate SpamContext
- instantiate ChatCommands
- add
OnSessionStartto Server's OnSessionStart delegate/event - (add
OnSessionEndto existing sessions, I guess on the mythical hot-reload)
Dispose()-- basically opposite ofInit()OnSessionStart(...)- broadcast "join" message if enabled
- send MOTD to joining session
- send CommandList
- set up SpamContext stuff with error-sender
- add
OnSessionEndto thesession.OnEnd
OnSessionEnd(...)- broadcast "leave" message if enabled
- undo spam setup stuff
PrepareAndLog(...)- TODO: does a bunch of funny stuff lol
- called from:
DataChathandler here in the module- for logging
DataEmoteas if they were chat if enabled SendTo, see above underDataChatsection/gc,/ccand/wto create the corresponding chat messages
Handle(... DataChat)- TODO: Does a bunch of stuff lol
Handle(... DataEmote)- just handled here for the logging part 🤷
Broadcast(...)- see also above under
DataChatsections - just creates a "server" DataChat message and shoves it into
Handle(DataChat)
- see also above under
SendTo(...)- creates a "server" DataChat to send to specific session (passed through PrepareAndLog)
event Action<ChatModule, DataChat>? OnReceiveevent Action<ChatModule, DataChat>? OnForceSendForceSend(DataChat)- uhh something
Metadata
Metadata
Assignees
Labels
Projects
Status

