def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "c2b.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY} conf_dict['config'] = {} conf_gui = { 'config': { 'addable': 'true', 'view': 'list_dual'}, 'non_dynamic': ['config.*']} config = self_heal(conf_file, conf_dict) self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': conf_dict, 'gui': conf_gui} tag_config = 'config' self.f_items = [] for param, value in config.items(tag_config): f_item = {'filter': param.decode('utf-8'), 'replace': value.split('/')} f_item['replace'] = [item.strip().decode('utf-8') for item in f_item['replace']] self.f_items.append(f_item)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "mentions.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['mentions'] = {} conf_dict['address'] = {} conf_gui = { 'mentions': { 'addable': 'true', 'view': 'list'}, 'address': { 'addable': 'true', 'view': 'list'}, 'non_dynamic': ['mentions.*', 'address.*']} config = self_heal(conf_file, conf_dict) self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui} mention_tag = 'mentions' address_tag = 'address' if config.has_section(mention_tag): self.mentions = [item for item, value in config.items(mention_tag)] else: self.mentions = [] if config.has_section(address_tag): self.addresses = [item.decode('utf-8').lower() for item, value in config.items(address_tag)] else: self.addresses = []
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) conf_file = os.path.join(conf_folder, "webchat.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'main', 'id': DEFAULT_PRIORITY } conf_dict['server'] = OrderedDict() conf_dict['server']['host'] = '127.0.0.1' conf_dict['server']['port'] = '8080' conf_dict['style'] = 'czt' conf_dict['style_settings'] = {'font_size': 15} conf_gui = { 'style': { 'check': 'http', 'check_type': 'dir', 'view': 'choose_single' }, 'style_settings': { 'font_size': { 'view': 'spin', 'min': 10, 'max': 100 } }, 'non_dynamic': ['server.*'] } config = self_heal(conf_file, conf_dict) fallback_style = 'czt' path = os.path.abspath(os.path.join(HTTP_FOLDER, conf_dict['style'])) if os.path.exists(path): style_location = path else: style_location = os.path.join(HTTP_FOLDER, fallback_style) self._conf_params = { 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': conf_dict, 'gui': conf_gui, 'host': conf_dict['server']['host'], 'port': conf_dict['server']['port'], 'style_location': style_location } self.queue = None self.message_threads = []
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Dwarf professions. conf_file = os.path.join(conf_folder, "blacklist.cfg") # Ordered because order matters conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY} conf_dict['main'] = {'message': u'ignored message'} conf_dict['users_hide'] = {} conf_dict['users_block'] = {} conf_dict['words_hide'] = {} conf_dict['words_block'] = {} conf_gui = { 'words_hide': { 'addable': True, 'view': 'list'}, 'words_block': { 'addable': True, 'view': 'list'}, 'users_hide': { 'view': 'list', 'addable': 'true'}, 'users_block': { 'view': 'list', 'addable': 'true'}, 'non_dynamic': ['main.*']} config = self_heal(conf_file, conf_dict) self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': OrderedDict(conf_dict), 'gui': conf_gui} for item in config.sections(): for param, value in config.items(item): if item == 'main': if param == 'message': self.message = value.decode('utf-8') elif item == 'users_hide': self.users[param] = 'h' elif item == 'words_hide': self.words[param] = 'h' elif item == 'users_block': self.users[param] = 'b' elif item == 'words_block': self.words[param] = 'b'
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Dwarf professions. conf_file = os.path.join(conf_folder, "df.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['grep'] = OrderedDict() conf_dict['grep']['symbol'] = '#' conf_dict['grep']['file'] = 'logs/df.txt' conf_dict['prof'] = {'nothing': '([Нн]икто|[Nn]othing|\w*)'} conf_gui = { 'prof': { 'view': 'list_dual', 'addable': True }, 'non_dynamic': ['grep.*'] } config = self_heal(conf_file, conf_dict) grep_tag = 'grep' prof_tag = 'prof' self._conf_params = { 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui } self.symbol = config.get(grep_tag, 'symbol') self.file = config.get(grep_tag, 'file') dir_name = os.path.dirname(self.file) if not os.path.exists(dir_name): os.makedirs(os.path.dirname(self.file)) if not os.path.isfile(self.file): with open(self.file, 'w'): pass self.prof = [] for prof, regex in config.items(prof_tag): comp = [prof.capitalize(), self.symbol + regex.decode('utf-8')] self.prof.append(comp)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) conf_file = os.path.join(conf_folder, "webchat.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'main', 'id': DEFAULT_PRIORITY } conf_dict['server'] = OrderedDict() conf_dict['server']['host'] = '127.0.0.1' conf_dict['server']['port'] = '8080' conf_dict['style'] = 'czt' conf_dict['style_settings'] = { 'font_size': 15 } conf_gui = { 'style': { 'check': 'http', 'check_type': 'dir', 'view': 'choose_single'}, 'style_settings': { 'font_size': {'view': 'spin', 'min': 10, 'max': 100}}, 'non_dynamic': ['server.*']} config = self_heal(conf_file, conf_dict) fallback_style = 'czt' path = os.path.abspath(os.path.join(HTTP_FOLDER, conf_dict['style'])) if os.path.exists(path): style_location = path else: style_location = os.path.join(HTTP_FOLDER, fallback_style) self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': conf_dict, 'gui': conf_gui, 'host': conf_dict['server']['host'], 'port': conf_dict['server']['port'], 'style_location': style_location} self.queue = None self.message_threads = []
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) conf_file = os.path.join(conf_folder, "levels.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['config'] = OrderedDict() conf_dict['config']['message'] = u'{0} has leveled up, now he is {1}' conf_dict['config']['db'] = os.path.join('conf', u'levels.db') conf_dict['config']['experience'] = u'geometrical' conf_dict['config']['exp_for_level'] = 200 conf_dict['config']['exp_for_message'] = 1 conf_dict['config']['decrease_window'] = 60 conf_gui = { 'non_dynamic': ['config.*'], 'config': { 'experience': { 'view': 'dropdown', 'choices': ['static', 'geometrical', 'random'] } } } config = self_heal(conf_file, conf_dict) self._conf_params = { 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui } self.conf_folder = None self.experience = None self.exp_for_level = None self.exp_for_message = None self.filename = None self.levels = None self.special_levels = None self.db_location = None self.message = None self.decrease_window = None self.threshold_users = None
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "mentions.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['mentions'] = {} conf_dict['address'] = {} conf_gui = { 'mentions': { 'addable': 'true', 'view': 'list' }, 'address': { 'addable': 'true', 'view': 'list' }, 'non_dynamic': ['mentions.*', 'address.*'] } config = self_heal(conf_file, conf_dict) self._conf_params = { 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui } mention_tag = 'mentions' address_tag = 'address' if config.has_section(mention_tag): self.mentions = [item for item, value in config.items(mention_tag)] else: self.mentions = [] if config.has_section(address_tag): self.addresses = [ item.decode('utf-8').lower() for item, value in config.items(address_tag) ] else: self.addresses = []
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "c2b.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY } conf_dict['config'] = {} conf_gui = { 'config': { 'addable': 'true', 'view': 'list_dual' }, 'non_dynamic': ['config.*'] } config = self_heal(conf_file, conf_dict) self._conf_params = { 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': conf_dict, 'gui': conf_gui } tag_config = 'config' self.f_items = [] for param, value in config.items(tag_config): f_item = { 'filter': param.decode('utf-8'), 'replace': value.split('/') } f_item['replace'] = [ item.strip().decode('utf-8') for item in f_item['replace'] ] self.f_items.append(f_item)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Dwarf professions. conf_file = os.path.join(conf_folder, "df.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['grep'] = OrderedDict() conf_dict['grep']['symbol'] = '#' conf_dict['grep']['file'] = 'logs/df.txt' conf_dict['prof'] = {'nothing': '([Нн]икто|[Nn]othing|\w*)'} conf_gui = { 'prof': { 'view': 'list_dual', 'addable': True}, 'non_dynamic': ['grep.*']} config = self_heal(conf_file, conf_dict) grep_tag = 'grep' prof_tag = 'prof' self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui} self.symbol = config.get(grep_tag, 'symbol') self.file = config.get(grep_tag, 'file') dir_name = os.path.dirname(self.file) if not os.path.exists(dir_name): os.makedirs(os.path.dirname(self.file)) if not os.path.isfile(self.file): with open(self.file, 'w'): pass self.prof = [] for prof, regex in config.items(prof_tag): comp = [prof.capitalize(), self.symbol + regex.decode('utf-8')] self.prof.append(comp)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "logger.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY } conf_dict['config'] = OrderedDict() conf_dict['config']['logging'] = True conf_dict['config']['file_format'] = '%Y-%m-%d' conf_dict['config']['message_date_format'] = '%Y-%m-%d %H:%M:%S' conf_dict['config']['rotation'] = 'daily' conf_gui = {'non_dynamic': ['config.*']} config = self_heal(conf_file, conf_dict) self._conf_params = { 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': conf_dict, 'gui': conf_gui } tag_config = 'config' self.format = config.get(tag_config, 'file_format') self.ts_format = config.get(tag_config, 'message_date_format') self.logging = config.get(tag_config, 'logging') self.rotation = config.get(tag_config, 'logging') self.folder = 'logs' self.destination = os.path.join(conf_folder, '..', self.folder) if not os.path.exists(self.destination): os.makedirs(self.destination)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) conf_file = os.path.join(conf_folder, "levels.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['config'] = OrderedDict() conf_dict['config']['message'] = u'{0} has leveled up, now he is {1}' conf_dict['config']['db'] = os.path.join('conf', u'levels.db') conf_dict['config']['experience'] = u'geometrical' conf_dict['config']['exp_for_level'] = 200 conf_dict['config']['exp_for_message'] = 1 conf_dict['config']['decrease_window'] = 60 conf_gui = {'non_dynamic': ['config.*'], 'config': { 'experience': { 'view': 'dropdown', 'choices': ['static', 'geometrical', 'random']}}} config = self_heal(conf_file, conf_dict) self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui} self.conf_folder = None self.experience = None self.exp_for_level = None self.exp_for_message = None self.filename = None self.levels = None self.special_levels = None self.db_location = None self.message = None self.decrease_window = None self.threshold_users = None
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "logger.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY } conf_dict['config'] = OrderedDict() conf_dict['config']['logging'] = True conf_dict['config']['file_format'] = '%Y-%m-%d' conf_dict['config']['message_date_format'] = '%Y-%m-%d %H:%M:%S' conf_dict['config']['rotation'] = 'daily' conf_gui = {'non_dynamic': ['config.*']} config = self_heal(conf_file, conf_dict) self._conf_params = {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': config.get('gui_information', 'id'), 'config': conf_dict, 'gui': conf_gui} tag_config = 'config' self.format = config.get(tag_config, 'file_format') self.ts_format = config.get(tag_config, 'message_date_format') self.logging = config.get(tag_config, 'logging') self.rotation = config.get(tag_config, 'logging') self.folder = 'logs' self.destination = os.path.join(conf_folder, '..', self.folder) if not os.path.exists(self.destination): os.makedirs(self.destination)