Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with Channel::isTwitchChannel #5703

Open
4 tasks done
Mm2PL opened this issue Nov 8, 2024 · 0 comments
Open
4 tasks done

Deal with Channel::isTwitchChannel #5703

Mm2PL opened this issue Nov 8, 2024 · 0 comments

Comments

@Mm2PL
Copy link
Collaborator

Mm2PL commented Nov 8, 2024

Checklist

  • I'm reporting a problem with Chatterino
  • I've verified that I'm running the most recent nightly build or stable release
  • I've looked for my problem on the wiki
  • I've searched the issues and pull requests for similar looking reports

Describe your issue

Currently client-side channels are "Twitch" channels for isTwitchChannel and have Twitch in the channel type enum. However they cannot be cast to TwitchChannel.

We should rework channel types, to resolve the type >= Twitch && type < TwitchEnd but can't be cast to TwitchChannel problem.

    enum class Type {
        None, // Unused? empty?
        Direct, // Actually indirect channel, not sure where it's used though
        Twitch, // Normal Twitch channel like #pajlada
	    // can execute commands, but not send messages, there are no moderator privileges, no vips, no broadcasters,
        // no stream titles, ...
        TwitchWhispers, 
        TwitchWatching,
        TwitchMentions, // this could be made into a generic channel, there is no point of it being Twitch specifically, it's not a TwitchChannel anyway.
        TwitchLive,
        TwitchAutomod,
        TwitchEnd,
        Misc, // this is for local testing channels, can be left as is
    };

The minimal modifications here would be:

    enum class Type {
        None,
        Direct,
        Twitch, // Normal Twitch channel like #pajlada
        Whispers, 
        Watching,
        Mentions,
        Live,
        Automod,
        Misc, // this is for local testing channels, can be left as is
    };
// make Channel::isTwitchChannel into:
bool Channel::isTwitchChannel() const {
	return this->type_ == Channel::Type::Twitch;
}

There was an idea where instead of having an enum for a channel we instead would have some kind of flags for what traits supports, ex:

enum ChannelFlags {
    PERMISSIONS = (1 << 0), // mods, vips, ...
    TWITCH_COMMANDS = (1<<1), // allow for /w and friends to run
    LOCAL = (1<<2),
    STREAM_TITLE = (1<<3),
    INDIRECT = (1<<4), // collects messages from more than one other channel, 
    // this could be used to add channel links at the start of messages (like /mentions)
};

Channel types would then be:

name flags comment
None LOCAL
Direct LOCAL Leave this without INDIRECT flag,
Twitch PERMISSIONS+TWITCH_COMMANDS+STREAM_TITLE
TwitchWhispers LOCAL+TWITCH_COMMANDS
TwitchWatching LOCAL+TWITCH_COMMANDS only one channel, so no need for INDIRECT
TwitchMentions LOCAL+INDIRECT
TwitchLive LOCAL
TwitchAutomod LOCAL+INDIRECT
TwitchEnd N/A A channel of this type shouldn't need to exist
Misc LOCAL

Screenshots

No response

OS and Chatterino Version

commit 5b1ce32 (HEAD -> master, origin/master, origin/HEAD)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant