Chatterino / chatterino2

Chat client for https://twitch.tv
MIT License
2.06k stars 449 forks source link

refactor: deduplicate IRC parsing #5678

Closed Nerixyz closed 2 weeks ago

Nerixyz commented 3 weeks ago

This deduplicates the code for parsing historical vs. live messages. It introduces a MessageSink which hold some traits (some behavior as to how messages should be added). It is modelled after the Channel, which is why it has the addMessage signature. Ideally, I'd want to make a new function that just takes a message, but I couldn't come up with a good name (because ultimately, it will add a message to the sink). An alternative could be to make MessageSink a wrapper around Channel.

This should make it easier to parse specific messages (e.g. subs) without introducing differences between recent and live messages.