There are many things that people want that we don't want to put in core. So we should have a plugin API to allow people to do these things.
I'm looking to start work on this, so I'm going to catalogue things that people will want to do with this. Once I have a first version working, I'll probably separate this into different issues for the other APIs that haven't been implemented.
Required APIs:
I'll flesh out the ideas for implementation later. Other ideas for APIs, stick them in comments on this post for just now, until we have the first plugin API.
I'll base the structure of a plugin on #1266
having never touched node.js this might sound stupid but is it feasible to make an event driven api?
like have events for messages receive in channels, pms, events for send messages, events for closing and opening a window or the whole client, stuff like that.
it also would be cool to have an api to provide new options for context menus (on users, on channels, on networks, on messages, ...)
those are the two things I would propose additionally to the things mentioned above.
It shouldn鈥檛 be too hard for acting on anything coming in from the irc server. A regex filter plugin like setup would work. This framework can also be used then for ignoring people, auto op people and more automated things.
I鈥檓 going to have to look into getting started with node myself.
I'm going to next implement a quick plugin support for custom commands.
This will have an endpoint for the plugins to call that will take the name of the command and a function to call when the command is run, plus a way to send other commands in it's place (I guess we'll probably want this to be a decorator pattern so that it will return the command that is sent to the server rather than this being as well as, because obviously the custom command wouldn't make any sense to the server), probably in the same style as we would send to irc fw (so command and args as an array).
It should ideally add the command to the client autocomplete, so that'll need to be passed from the server to the client on setup otherwise it'll have to rebuild the client which is ... not ideal. Any thoughts on this?
Would it be possible to divide this work into parts so that we can help?
As discussed in IRC, yes, the base server plugins exist. I'll be working on the plugin feature you want soon though.
just sharing some ideas what apis that could be added:
commands
You probably already know, but all 3 of these are essentially covered by #2757
modify outgoing messages
add setting elements (dropdown, textinput, checkbox, radio...)
Yeah, I want to focus on these 2 next. These will cover a large number of plugin ideas that people have.
add new entries to existing context menus
This will be very easy because of my refactor a few months ago. I'm pretty sure I basically did it at one point but ... I can't find the code anymore. Dunno what I did with that. Ah well, I don't think it'll take too much work to add now.
The rest look generally good. I think once we have a few of these done, we should probably close this ticket and turn them into individual ones. Otherwise this will just stay open forever.
@MiniDigger There's also https://github.com/thelounge/thelounge/projects/4#card-8072845 which has a bunch of stuff. I need to go through your list and check if there's anything that isn't in the project. I don't think non-contributors can add things to boards, can they?
Reviving this ticket. No I can't add new cards to boards. Since the command api did land now and I got to try it, these are my things that I find missing:
I also did update https://github.com/thelounge/thelounge/issues/1422#issuecomment-419010160
(registering dynamically works, but it doesn't get synced to the client it seems)
I presume it works if you refresh the page? I think all we need to do is just send an updated commands to each connected client. Shouldn't be too difficult.
dynamically unregistering commands (both on the server and in the completion list)
Good shout.
Although, regarding these, presuming this is for your plugin, remember that these commands are for all users, not per user, so if you are adding aliases, etc, all users will be able to see them. That's maybe not an issue for you, but something to bear in mind.
Ahh, yeah, reloading works.
And thanks for mentioning that commands are per instance and not per user, I kinda forgot that thelounge can be used by multiple users ^^
Is this still on? I would love to be able to make URL preview plugins for various systems.
Yes but no one has had time to work on it. PRs are welcome.
Hey, I'm wanting to use the general events plugin structure to have push notifications via sms in something like twilio. Is there a good place to look for how i would start implementing this plugin structure so that such a plugin can be created? What I'm thinking is mainly server side event processing.
Currently there aren't any recommendations since the plugin API is still very basic.
So are you planning to add a way to connect to other IM protocols than IRC?
(fwiw: I am not a JS dev so I have no clue if any of this is good, but I think its reasonably well organized)
@richrd That was my intention, yes. I was planning to potentially include support for Telegram, Slack and Teams if I could, as I'd really like a nice central application to manage all my IM needs from without using a bunch of IRC bridges. I was hoping to make a nice little framework to be able to base further IM providers on.
@Makeshift For now you're better off using bridge servers that can expose various services as IRC servers and connect to that. Like bitlbee.
As it stands, there's currently no one that is willing to work on the plugin system.
Most helpful comment
just sharing some ideas what apis that could be added: