Apply word filtering rules to usernames on player connect #533
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rather than adding much specialized handling I just treat a connect event as a chat message with the player's name in it. This is a bit annoying since it shows up on the site's chat log, but I suppose it could be a good log to protect against users changing their names a lot (in an attempt to hide something offensive). Followups could hide those messages from showing up on the site.
While testing on my server, I realized that automatic actions on chat messages didn't seem to be working at all (maybe I'm missing some setup?). I fixed that here by having chat_usecase listen to chat_repository's WarningChan.
Another new change here is that we kick based off of the server id and player id from the log event instead of doing a lookup by steamid. This is pretty necessary as it's very unlikely we'll have gotten a status update from the server before the connect event... This also fixes an issue where users could avoid auto-kicks for chat messages if they said something offensive very shortly after joining a server.
There's a small loophole, that we don't check usernames continuously... So if an offensive username joins while the gbans server is restarting they'll get to stay in the server.
Fixes #435