sylae / ligrev

XMPP MUC Utility bot
GNU General Public License v3.0
2 stars 1 forks source link

Support for command and IQ plugins #16

Open sylae opened 8 years ago

sylae commented 8 years ago

The big draw to Ligrev should be being able to write your own commands and include them in Ligrev's parser. As we are already using some simple classes, this should not be too hard to extend:

Some options:

  1. Register plugins through an array in $config. Probably easiest to implement, but not very friendly.
  2. Use some sort of function and call it via spl_autoload_register(). This way users can just toss command classes into a directory and call it a day. Would take a little bit of work to do, but not too bad.
  3. Use composer now that we use composer. This way the vendor autoload takes care of loading the class for us. Least amount of effort to implement, as devs just need to extend the \Ligrev\command class. Could be a messier can of worms than needed, though.

In any case, extending Ligrev in this fashion will require some simple changes, like abstracting away most/all of JAXL's functionality (although this should be done anyway) to a master Ligrev class, or something.

sylae commented 8 years ago

On this: I think a hybrid of options 2 and 3 would be ideal. The builtin commands will be called via spl_autoload_register() and composer can load any contributed classes.

sylae commented 8 years ago

Ligrev is currently already "dynamically" (heavy air quotes there) all commands and IQ parsers. In addition, the IQ class system is relatively friendly to extending. Commands, however, probably need a fair amount of work before we can close this.