예제 #1
0
파일: core.py 프로젝트: TheArchives/Inter
 def __init__(self, factory, addr):
     self.factory = factory
     self.host = addr.host
     self.logger = logging.getLogger("Protocol")
     self.events = manager.manager()
     self.id = None
     self.pings = []
예제 #2
0
파일: core.py 프로젝트: TheArchives/Inter
    def __init__(self):
        self.servers = {}
        self.clients = []
        self.logger = logging.getLogger("Factory")
        self.plugman = PluginManagerSingleton.get()
        self.events = manager.manager()
        self.plugman.setPluginPlaces(["plugins"])
        self.plugman.setPluginInfoExtension("plug")
        self.plugman.collectPlugins()

        self.logger.info("Loading plugins..")
        for pluginInfo in self.plugman.getAllPlugins():
            try:
                self.plugman.activatePluginByName(pluginInfo.name)
                pluginInfo.plugin_object._add_variables(pluginInfo, self)
                pluginInfo.plugin_object.setup()
            except Exception:
                self.logger.warn("Unable to load plugin: %s v%s" % (pluginInfo.name, pluginInfo.version))
                util.output_exception(self.logger, logging.WARN)
                self.plugman.deactivatePluginByName(pluginInfo.name)
            else:
                self.logger.info("Loaded plugin: %s v%s" % (pluginInfo.name, pluginInfo.version))
                event = pluginLoadedEvent(self, pluginInfo)
                self.events.runCallback("pluginLoaded", event)
        self.logger.info("Finished loading plugins.")

        event = pluginsLoadedEvent(self)
        self.events.runCallback("pluginsLoaded", event)
예제 #3
0
 def setup(self):
     self.config = conf.conf()
     if not self.config.get_mapping("echo"):
         self.config.save_mapping("echo", "echo.yml")
         self.config.save_file("echo.yml", {"enabled": True})
         self.config.reload()
     self.events = manager.manager()
     self.events.addCallback("dataReceived", self, self.onDataReceived, 10)
예제 #4
0
 def setup(self):
     self.config = conf.conf()
     if not self.config.get_mapping("hello"):
         self.config.save_mapping("hello", "hello.yml")
         self.config.save_file("hello.yml", {"message": "Hello, world!"})
         self.config.reload()
     self.events = manager.manager()
     self.events.addCallback("dataReceived", self, self.onDataReceived, 1)
     self.logger.info(self.config.get("hello")["message"])
예제 #5
0
 def setup(self):
     self.config = conf.conf()
     self.logger = logging.getLogger("Auth")
     if not self.config.get_mapping("auth"):
         self.config.save_mapping("auth", "auth.yml")
         self.config.save_file("auth.yml", {"keys": {}})
         self.config.reload()
     self.events = manager.manager()
     self.events.addCallback("dataReceived", self, self.onDataReceived, 99999)
     self.events.addCallback("protocolBuilt", self, self.onProtocolBuiltEvent, 99999)
     self.events.addCallback("clientDisconnected", self, self.onClientDisconnected, 0)
예제 #6
0
 def setup(self):
     self.config = conf.conf()
     self.logger = logging.getLogger("Players")
     self.events = manager.manager()
     self.events.addCallback("dataReceived", self, self.onDataReceived, 0)
     self.events.addCallback("protocolBuilt", self, self.onProtocolBuiltEvent, 99999)