twisted invoces callbacks just by invocing the function of the class implementing the Protocol (i.e. IRCClient
). we need to run a lot of plugins, so our structure is a bit more complicated.
we implement the twisted-callbacks, and run _apirunner(“callback”, {'argument': argument}).
_apirunner looks into self.callbacks
, which is a dict {'callback': [(plugininstance, priority)]}
the list [(plugin, priority)] is sorted by priority, so the most important callbacks (rarely used, but needed i.e for ircServer
) are executed first.
the pluginSupport.callback list is filled on startPlugin
with all plugin-functions, which have is_callback set. use pluginSupport.decorators.callback
to set this statically.
if you need to register callbacks dynamic, pluginSupport has registerCallback
and unregisterCallback
.