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

Add plugin support #1422

Open
AlMcKinlay opened this issue Aug 16, 2017 · 24 comments
Open

Add plugin support #1422

AlMcKinlay opened this issue Aug 16, 2017 · 24 comments
Assignees
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects

Comments

@AlMcKinlay
Copy link
Member

AlMcKinlay commented Aug 16, 2017

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:

  • Command aliases - this is a surprisingly common thing, and would just involve a plugin telling us what the alias is called, and what command it should call. This could easily include
  • Database - a plugin could provide a new database connection which will provide a way to give it new log lines to store, and a way to get all the logs at startup (could be expanded in the future)
  • Settings - a way for plugins to give a list of settings, with different types, that will be put in the settings page and we will pass the user input to the plugin

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

@AlMcKinlay AlMcKinlay added the Type: Feature Tickets that describe a desired feature or PRs that add them to the project. label Aug 16, 2017
@AlMcKinlay AlMcKinlay self-assigned this Aug 16, 2017
@MiniDigger
Copy link
Contributor

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.

@miwagner1
Copy link

It shouldn’t 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’m going to have to look into getting started with node myself.

@AlMcKinlay
Copy link
Member Author

AlMcKinlay commented Dec 4, 2017

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?

@AlMcKinlay AlMcKinlay added this to In progress in Plugins Mar 12, 2018
@rain-1
Copy link

rain-1 commented Jun 4, 2018

Would it be possible to divide this work into parts so that we can help?

@AlMcKinlay
Copy link
Member Author

As discussed in IRC, yes, the base server plugins exist. I'll be working on the plugin feature you want soon though.

@MiniDigger
Copy link
Contributor

MiniDigger commented Sep 6, 2018

just sharing some ideas what apis that could be added:

  • commands
    • custom commands
    • add to auto complete
    • aliases (not 100% sure they are done?)
    • dynamically registering and unregistering commands
  • settings
    • add setting elements (dropdown, textinput, checkbox, radio...)
    • have its own settings category/page
    • define if a setting should be syncable or not
  • context menu
    • add new entries to existing context menus
    • add context menus to new elements
  • windows
    • ability to add new windows
    • add buttons to existing windows to open custom windows (for example lower left button bar)
  • chat messages
    • modify outgoing messages
    • modify incoming messages
  • message storage
    • new possible storage types
  • client api
    • send message to the client (with a non error message type)
  • general event api
    • listen to all kind of events and react and possibly modify the event/outcome
    • command, tab complete, pm, message (in/out), window (open/close), setting change,. .....

@AlMcKinlay
Copy link
Member Author

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.

@AlMcKinlay
Copy link
Member Author

@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?

@MiniDigger
Copy link
Contributor

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:

  • dynamically add command to the completion list (registering dynamically works, but it doesn't get synced to the client it seems)
  • dynamically unregistering commands (both on the server and in the completion list)

I also did update #1422 (comment)

@AlMcKinlay
Copy link
Member Author

(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.

@MiniDigger
Copy link
Contributor

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 ^^

@fuzzy76
Copy link

fuzzy76 commented Mar 23, 2020

Is this still on? I would love to be able to make URL preview plugins for various systems.

@richrd
Copy link
Member

richrd commented Mar 23, 2020

Yes but no one has had time to work on it. PRs are welcome.

@kruffin
Copy link

kruffin commented Jun 10, 2020

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.

@Makeshift
Copy link

Is there any documentation available on recommended practices when writing plugins? I was looking to add first-class support for additional IM providers via plugins. I found a couple of plugins available but am unsure if they're following best practice.

@richrd
Copy link
Member

richrd commented Aug 17, 2020

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?

@MiniDigger
Copy link
Contributor

(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)

@Makeshift
Copy link

@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.

@xPaw
Copy link
Member

xPaw commented Aug 17, 2020

@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.

@fuzzy76
Copy link

fuzzy76 commented Mar 26, 2021

For now you're better off using bridge servers that can expose various services as IRC servers and connect to that. Like bitlbee.

Just out of curiosity, do you know any good alternatives to bitlbee? I ran it for a while, but found it to way to confusing both at configuration and general operation as soon as you added a handful of protocols.

@bialad
Copy link

bialad commented Apr 13, 2021

I looked at adding support for postgres today, and I guess that's relevant for this issue. Is there any work for making a message store interface? Because I guess it would need to be generalized first.

@cinderblock
Copy link

I want to monitor a channel for certain words from certain users and be able to log/do something with those events. It feels like I would need plugin support to be able to do this. Or is there some way to do this already that I'm not seeing? (Besides hacking it into the source myself)

@daomengRen
Copy link

I want to monitor a channel for certain words from certain users and be able to log/do something with those events. It feels like I would need plugin support to be able to do this. Or is there some way to do this already that I'm not seeing? (Besides hacking it into the source myself)

Yes, I also want such a plugin, on this basis, it can also send me notifications, I don’t know if there is such a plugin or API

@dgw
Copy link
Contributor

dgw commented Mar 28, 2024

One important area missing from MiniDigger's handy summary is a file storage API (as distinct from message storage, which is already listed). See e.g. #4177 and #4850.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
Plugins
  
In progress
Development

No branches or pull requests