def __init__(self, ploader, kwargs): del kwargs['settings_mixin'] self.plugin_list = [] temp_set = {} if 'settings' in kwargs: settings = get_settings(kwargs, kwargs['settings']) del kwargs['settings'] else: settings = kwargs if 'file_path' in settings: temp_set = self._import_yaml(kwargs['file_path'], 'plugins') del settings['file_path'] for key, val in temp_set.items(): settings[key] = get_settings(settings.get(key, {}), val) if 'plugins' in settings: self.plugin_list = settings['plugins'] del settings['plugins'] plugins = [] plugin_settings = {} for plugin in self.plugin_list: plugins.append(plugin[1]) plugin_settings[plugin[1]] = temp_set[plugin[0]] ploader.provides('PloaderFetch', PloaderFetch(plugins, plugin_settings))
def __init__(self, ploader, settings): self.settings = utils.get_settings(default_settings, settings) self.event = ploader.requires('Event') self.net = ploader.requires('Net') self.auth = ploader.requires('Auth') setattr(ploader, 'start', self.start)
def __init__(self, ploader, kwargs): settings = get_settings(kwargs.get("settings", {}), kwargs) plugin_list = settings.get("plugins", DefaultPlugins) plugins = [] plugin_settings = {} for plugin in plugin_list: plugins.append(plugin[1]) plugin_settings[plugin[1]] = settings.get(plugin[0], {}) ploader.provides("PloaderFetch", PloaderFetch(plugins, plugin_settings))
def __init__(self, ploader, kwargs): settings = get_settings(kwargs, kwargs.get('settings', {})) plugin_list = settings.get('plugins', DefaultPlugins) plugins = [] plugin_settings = {} for plugin in plugin_list: plugins.append(plugin[1]) plugin_settings[plugin[1]] = settings.get(plugin[0], {}) ploader.provides('PloaderFetch', PloaderFetch(plugins, plugin_settings))
def _import_yaml(self, path, obj): temp_set = {} data = yaml.load(open(path).read()) for key, plugin in data[obj].items(): if plugin[0] == 'yaml': for key, val in self._import_yaml(plugin[1], key).items(): temp_set[key] = get_settings(temp_set.get(key, {}), val) elif plugin[0] == 'python': for key, _ in self._import_python(plugin[1], key): temp_set[key] = data.get(key, {}) else: self._import_plugin(plugin[1], plugin[0], key) temp_set[key] = data.get(key, {}) return temp_set
def __init__(self, ploader, settings): settings = utils.get_settings(default_settings, settings) self.event = ploader.requires('Event') self.net = ploader.requires('Net') self.authenticated = settings['authenticated'] self.sess_quit = settings['sess_quit'] self.auth = AuthCore(self.authenticated, self.event) self.auth.gen_shared_secret() ploader.reg_event_handler('AUTH_ERR', self.handleAUTHERR) ploader.reg_event_handler('SESS_ERR', self.handleSESSERR) ploader.reg_event_handler( 'LOGIN<Encryption Request', self.handle_encryption_request ) ploader.provides('Auth', self.auth)
def __init__(self, ploader, settings): settings = utils.get_settings(settings, default_settings) self.event = ploader.requires('Event') self.net = ploader.requires('Net') self.authenticated = settings['authenticated'] self.sess_quit = settings['sess_quit'] self.auth = AuthCore(self.authenticated, self.event) self.auth.gen_shared_secret() ploader.reg_event_handler('AUTH_ERR', self.handleAUTHERR) ploader.reg_event_handler('SESS_ERR', self.handleSESSERR) ploader.reg_event_handler( (mcdata.LOGIN_STATE, mcdata.SERVER_TO_CLIENT, 0x01), self.handle01 ) ploader.provides('Auth', self.auth)
def __init__(self, ploader, settings): # Load the plugin's settings. self.settings = get_settings(self.defaults, settings) # Load all the plugin's dependencies. if isinstance(self.requires, basestring): setattr(self, self.requires.lower(), ploader.requires(self.requires)) else: for requirement in self.requires: setattr(self, requirement.lower(), ploader.requires(requirement)) # Setup the plugin's event handlers. for event in self.events.keys(): if hasattr(self, self.events[event]): ploader.reg_event_handler(event, getattr(self, self.events[event])) else: raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, self.events[event]))
def __init__(self, ploader, settings): settings = utils.get_settings(settings, default_settings) self.bufsize = settings['bufsize'] self.sock_quit = settings['sock_quit'] self.event = ploader.requires('Event') self.timer = ploader.requires('Timers') self.sock = SelectSocket(self.timer) self.net = NetCore(self.sock, self.event) self.sock_dead = False ploader.provides('Net', self.net) ploader.reg_event_handler('event_tick', self.tick) ploader.reg_event_handler('SOCKET_RECV', self.handleRECV) ploader.reg_event_handler('SOCKET_SEND', self.handleSEND) ploader.reg_event_handler('SOCKET_ERR', self.handleERR) ploader.reg_event_handler('SOCKET_HUP', self.handleHUP) ploader.reg_event_handler('PLAY<Disconnect', self.handle_disconnect) ploader.reg_event_handler('HANDSHAKE>Handshake', self.handle_handshake) ploader.reg_event_handler('LOGIN<Login Success', self.handle_login_success) ploader.reg_event_handler('LOGIN<Set Compression', self.handle_comp) ploader.reg_event_handler('PLAY<Set Compression', self.handle_comp) ploader.reg_event_handler('kill', self.handle_kill)
def __init__(self, ploader, settings): settings = utils.get_settings(settings, default_settings) self.bufsize = settings['bufsize'] self.sock_quit = settings['sock_quit'] self.event = ploader.requires('Event') self.timer = ploader.requires('Timers') self.sock = SelectSocket(self.timer) self.net = NetCore(self.sock, self.event, self.timer) self.sock_dead = False ploader.provides('Net', self.net) ploader.reg_event_handler('event_tick', self.tick) ploader.reg_event_handler('SOCKET_RECV', self.handleRECV) ploader.reg_event_handler('SOCKET_SEND', self.handleSEND) ploader.reg_event_handler('SOCKET_ERR', self.handleERR) ploader.reg_event_handler('SOCKET_HUP', self.handleHUP) ploader.reg_event_handler('PLAY<Disconnect', self.handle_disconnect) ploader.reg_event_handler('HANDSHAKE>Handshake', self.handle_handshake) ploader.reg_event_handler('LOGIN<Login Success', self.handle_login_success) ploader.reg_event_handler('LOGIN<Set Compression', self.handle_comp) ploader.reg_event_handler('PLAY<Set Compression', self.handle_comp) ploader.reg_event_handler('kill', self.handle_kill)