Add a method for remote admins to send chat messages from external sources #9563
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.
Motivation / Problem
Many OpenTTD communities bridge ingame chat with discord/irc or other servers. Previously common solution for that would be to give the server client an empty name (so it doesn't prepend them with awkward Server: or smith) and make it send those external messages. In 12.0 it's no longer possible to give the server an empty name and while one could always name it ":" it's ridiculous and the appearance of the chat messages changed anyway so I decided to make a dedicated method for it. I also thought of making a more generic method but while it may be useful it would require an admin to somehow manage the formatting of messages in sync with possible future changes and external chat is a common enough use case anyway to deserve a dedicated method.
Description
Add ADMIN_EXTERNAL_CHAT packet that receives message text, sender, and source as strings as well as text colour and passes it through to the clients to show.
Simple remote admin script in python for testing: testadmin.zip
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
The bug fix is important enough to be backported? (label: 'backport requested')This PR affects the save game format? (label 'savegame upgrade')This PR affects the GS/AI API? (label 'needs review: Script API')This PR affects the NewGRF API? (label 'needs review: NewGRF')