feat(plugins): Add message signals#6781
Open
Nerixyz wants to merge 3 commits intoChatterino:masterfrom
Open
Conversation
Collaborator
|
**They're all synchronous.** This makes the implementation fairly straight forward, but also a trivial stack overflow.
IMO the only viable solution (which keeps this sync) would be to limit
callback depth. We have a ton of things that add messages (the plugin
adding the message, another plugin adding another message, commands to
name a few). We could stop calling plugins once they have been called
into more than X times, where X is a sufficiently big number to not be
hit in normal usage.
Other than Chatterino crashing, this shouldn't have any consequences, because the OS will kill the process.
This is mostly a nice feature *I want*
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds
Channel:on_message{_appended, _replaced, s_cleared}. They use the same functionality as the display name changed signal and forward the respective signals inChannel.They're all synchronous. This makes the implementation fairly straight forward, but also a trivial stack overflow. Other than Chatterino crashing, this shouldn't have any consequences, because the OS will kill the process. Note that a plugin can already halt Chatterino by executing an infinite loop, because plugins run in the GUI thread.
We still have to be careful that we don't destroy the channel as part of a callback (or at least delay that). For now that's not an issue.