def setup(self): self.webhook = NebHookServer(8500) self.webhook.daemon = True self.webhook.start() # init the plugins for cls_name in self.plugin_cls: self.plugins[cls_name] = self.plugin_cls[cls_name](self.matrix, self.config, self.webhook) while True: try: sync = self.matrix.initial_sync() break except ConnectionError: pass log.debug("Notifying plugins of initial sync results") for plugin_name in self.plugins: plugin = self.plugins[plugin_name] plugin.on_sync(sync) # see if this plugin needs a webhook if plugin.get_webhook_key(): self.webhook.set_plugin(plugin.get_webhook_key(), plugin)
def setup(self): self.webhook = NebHookServer(8500) self.webhook.daemon = True self.webhook.start() # init the plugins for cls_name in self.plugin_cls: self.plugins[cls_name] = self.plugin_cls[cls_name](self.matrix, self.config, self.webhook) sync = self.matrix.sync(timeout_ms=30000, since=self.sync_token) self.parse_sync(sync, initial_sync=True) log.debug("Notifying plugins of initial sync results") for plugin_name in self.plugins: plugin = self.plugins[plugin_name] plugin.on_sync(sync) # see if this plugin needs a webhook if plugin.get_webhook_key(): self.webhook.set_plugin(plugin.get_webhook_key(), plugin)