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

Chat Channel API - Plugin Export #65

Open
Geekid812 opened this issue Jun 30, 2023 · 1 comment
Open

Chat Channel API - Plugin Export #65

Geekid812 opened this issue Jun 30, 2023 · 1 comment

Comments

@Geekid812
Copy link

As Better Chat is a fully fledged chat replacement, it seems interesting to provide other plugins a way to use BC to implement their own chat channels/servers (this is completely unrelated to other plugins I am developing, of course). This is sort of similar in spirit to #53, but should allow plugins to have more flexibility to act as a controller for how messages are passed in an out of a channel.

A simple API implementation example could be:

shared interface IChatChannelHook
{
    void WriteLine(... data);
    void WriteSystemMessage(... data);
    void Clear();
}

shared interface IChatChannelSink
{
    void Send(const string&in text);
}

IChatChannelHook@ AquireChatChannelHook(IChatChannelSink@ sink);
void ReleaseChatChannelHook(IChatChannelHook@ hook);

When the hook is acquired, the plugin should consider that a new chat channel was created, akin to being connected to a server in the current version. Then, the dependant plugin can write incoming messages to the channel by calling methods on the hook and they should be sent to all listeners to display. Conversely, sent text messages will be routed from BC to the external plugin with the channel sink call.

This current implementation was thought out to work like a mutex, so that only one plugin controls the chat at once. Another possibility could be to create a new tab for each created channel to allow multiple channels to exist simultanously.

I have implemented a prototype version to test out how it could work. Some internal refactorings will need to be made to ChatLineInfo to adapt to arbitrary input, then it should be a matter of passing down parameters from ChatWindow and ChatLine.

@codecat
Copy link
Owner

codecat commented Jul 15, 2023

Not a bad idea. The biggest hurdle to overcome is designing what these channels would look like in UI.

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

No branches or pull requests

2 participants