Skip to content
theepicsnail edited this page Mar 6, 2011 · 4 revisions

A service is similar to a plugin as it's not loaded until its desired. However, services do not get to send responses to the Connector. A service gets access to the Core, PluginManager, PluginDispatcher, and Events.

The purpose of a service is to provide extra functionality to plugins that desire this functionality. In the case of IRC, a plugin that logs the chat may not need the ability to color messages, but a plugin that searches google could want to colorize the output.

An example of a service that gives plugins an optional 'time' parameter, TimeService.py

from time import time
class TimeService:
   def onEvent(self,event):
      event['time']= time()

A service may also give a plugin more powerful features, like access to the PluginManager

class PluginManagerService:
   pm = None

   def SetPluginManager(self,p):
      self.pm = p

   def onEvent(self,event):
      event['unload']=self.pm.unloadPlugin
      event['load']=self.pm.loadPlugin

TODO

  • Actually implement services
Clone this wiki locally