def check(_): if self._pending: log.debug("Waiting on %d plugin commands" % len(self._pending)) d = defer.DeferredList(self._pending, consumeErrors=True) d.addBoth(check) return d else: log.trace("All plugin commands complete")
def hook(self, conn, event): log.trace("event: %s" % str(event)) for func in self.hooks[event['type']]: try: d = func(conn, event.copy()) except: log.error(failure.Failure()) else: self._add_pending(d)
def command(self, conn, event): log.trace("command: %s: %s" % (event['command'], event['text'])) if event['command'] in self.commands: try: d = self.commands[event['command']](conn, event.copy()) except: log.error(failure.Failure()) else: self._add_pending(d) else: self.hook(conn, event)
def _load(self): """Load all available plugins""" self.plugins = getPlugins(IHackabotPlugin, plugins) self.commands = {} self.hooks = {} for hook in self.hook_types: self.hooks[hook] = [] for plugin in self.plugins: log.trace("Found plugin: %s" % plugin) for attr in dir(plugin): if attr[0] == '_': continue log.trace("Found plugin attr: %s" % attr) self._check_attr(plugin, attr)
def sendLine(self, line): if line.startswith("error"): log.warn(line, prefix=self._pid) else: log.trace(line, prefix=self._pid)
def outReceived(self, data): log.trace(data.strip(), prefix=self._pid) self.dataReceived(data)
def irc_unknown(self, prefix, command, params): log.trace("unknown: %s %s %s" % (prefix, command, params))