phergie / phergie-irc-bot-react

IRC bot built on React
BSD 2-Clause "Simplified" License
81 stars 26 forks source link

Add ClientInjector plugin processor #11

Closed elazar closed 9 years ago

elazar commented 9 years ago

While phergie/phergie-irc-client-react supports reconnecting, there's no way to access that functionality from a plugin for phergie/phergie-irc-bot-react. Add this support via a plugin processor.

  1. Add a new interface, Phergie\Irc\Bot\React\ClientAwareInterface, that is equivalent to EventEmitterAwareInterface for an instance of Phergie\Irc\Client\React\ClientInterface.
  2. Add a new class, Phergie\Irc\Bot\React\PluginProcessor\ClientInjector, that implements PluginProcessorInterface and injects an instance of ClientAwareInterface into the plugin it receives.
  3. Add an instance of ClientInjector to the list of plugin processors in Bot->getDefaultPluginProcessors().

Once this work is done, a plugin should be able to implement the ClientAwareInterface interface, receive the Phergie\Irc\Client\React\ClientInterface instance in use by the Phergie\Irc\Bot\React\Bot instance, and make use of its reconnection support.

elazar commented 9 years ago

Fixed by #10.