def __init__(self, config): super().__init__(config) identity = config.BOT_IDENTITY self.jid = identity['username'] # backward compatibility self.password = identity['password'] self.server = identity.get('server', None) self.feature = config.__dict__.get('XMPP_FEATURE_MECHANISMS', {}) self.keepalive = config.__dict__.get('XMPP_KEEPALIVE_INTERVAL', None) self.ca_cert = config.__dict__.get( 'XMPP_CA_CERT_FILE', '/etc/ssl/certs/ca-certificates.crt') self.xhtmlim = config.__dict__.get('XMPP_XHTML_IM', False) # generic backend compatibility self.bot_identifier = self._build_person(self.jid) self.conn = self.create_connection() self.conn.add_event_handler("message", self.incoming_message) self.conn.add_event_handler("session_start", self.connected) self.conn.add_event_handler("disconnected", self.disconnected) # presence related handlers self.conn.add_event_handler("got_online", self.contact_online) self.conn.add_event_handler("got_offline", self.contact_offline) self.conn.add_event_handler("changed_status", self.user_changed_status) # MUC subject events self.conn.add_event_handler("groupchat_subject", self.chat_topic) self._room_topics = {} self.md_xhtml = xhtml() self.md_text = text()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") if hasattr(self.bot_config, 'BOT_IDENTITY') and 'username' in self.bot_config.BOT_IDENTITY: self.bot_identifier = self.build_identifier(self.bot_config.BOT_IDENTITY['username']) else: # Just a default identity for the bot if nothing has been specified. self.bot_identifier = self.build_identifier('@errbot') log.debug('Bot username set at %s.', self.bot_identifier) self._inroom = False self._rooms = [] self._multiline = False self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0]) self._register_identifiers_pickling()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") try: # Load readline for better editing/history behaviour import readline except ImportError: # Readline is Unix-only log.debug("Python readline module is not available") pass self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr( self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
def __init__(self, config): super().__init__(config) identity = config.BOT_IDENTITY self.jid = identity['username'] # backward compatibility self.password = identity['password'] self.server = identity.get('server', None) self.feature = config.__dict__.get('XMPP_FEATURE_MECHANISMS', {}) self.keepalive = config.__dict__.get('XMPP_KEEPALIVE_INTERVAL', None) self.ca_cert = config.__dict__.get('XMPP_CA_CERT_FILE', '/etc/ssl/certs/ca-certificates.crt') self.xhtmlim = config.__dict__.get('XMPP_XHTML_IM', False) self.use_ipv6 = config.__dict__.get('XMPP_USE_IPV6', None) # generic backend compatibility self.bot_identifier = self._build_person(self.jid) self.conn = self.create_connection() self.conn.add_event_handler("message", self.incoming_message) self.conn.add_event_handler("session_start", self.connected) self.conn.add_event_handler("disconnected", self.disconnected) # presence related handlers self.conn.add_event_handler("got_online", self.contact_online) self.conn.add_event_handler("got_offline", self.contact_offline) self.conn.add_event_handler("changed_status", self.user_changed_status) # MUC subject events self.conn.add_event_handler("groupchat_subject", self.chat_topic) self._room_topics = {} self.md_xhtml = xhtml() self.md_text = text()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") if hasattr( self.bot_config, 'BOT_IDENTITY') and 'username' in self.bot_config.BOT_IDENTITY: self.bot_identifier = self.build_identifier( self.bot_config.BOT_IDENTITY['username']) else: # Just a default identity for the bot if nothing has been specified. self.bot_identifier = self.build_identifier('@errbot') log.debug('Bot username set at %s.', self.bot_identifier) self._inroom = False self._rooms = [] self._multiline = False self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr( self.bot_config, 'TEXT_DEMO_MODE') else False if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0]) self._register_identifiers_pickling()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") try: # Load readline for better editing/history behaviour import readline except ImportError: # Readline is Unix-only log.debug("Python readline module is not available") pass self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark') self.user = self.build_identifier(self.bot_config.BOT_ADMINS[0])
def __init__(self, config): super(XMPPBackend, self).__init__(config) identity = config.BOT_IDENTITY self.jid = identity["username"] # backward compatibility self.password = identity["password"] self.server = identity.get("server", None) self.feature = config.__dict__.get("XMPP_FEATURE_MECHANISMS", {}) self.keepalive = config.__dict__.get("XMPP_KEEPALIVE_INTERVAL", None) self.ca_cert = config.__dict__.get("XMPP_CA_CERT_FILE", "/etc/ssl/certs/ca-certificates.crt") # generic backend compatibility self.bot_identifier = self.build_identifier(self.jid) self.conn = self.create_connection() self.conn.add_event_handler("message", self.incoming_message) self.conn.add_event_handler("session_start", self.connected) self.conn.add_event_handler("disconnected", self.disconnected) # presence related handlers self.conn.add_event_handler("got_online", self.contact_online) self.conn.add_event_handler("got_offline", self.contact_offline) self.conn.add_event_handler("changed_status", self.user_changed_status) # MUC subject events self.conn.add_event_handler("groupchat_subject", self.chat_topic) self._room_topics = {} self.md_xhtml = xhtml() self.md_text = text()
def __init__(self, config): super().__init__(config) self.bot_identifier = self.build_identifier('Err') # create window and components self.app = ChatApplication(sys.argv, backend=self, config=self.bot_config) self.md = xhtml()
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.rooms = set() self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_ansi = ansi() self.md_lexer = get_lexer_by_name("md", stripall=True) self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.rooms = set() self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_ansi = ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr(self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) log.debug("Text Backend Init.") self.bot_identifier = self.build_identifier('Err') self.demo_mode = self.bot_config.TEXT_DEMO_MODE if hasattr( self.bot_config, 'TEXT_DEMO_MODE') else False self._rooms = set() if not self.demo_mode: self.md_html = xhtml() # for more debug feedback on md self.md_text = text() # for more debug feedback on md self.md_borderless_ansi = borderless_ansi() self.md_im = imtext() self.md_lexer = get_lexer_by_name("md", stripall=True) self.md_ansi = ansi() self.html_lexer = get_lexer_by_name("html", stripall=True) self.terminal_formatter = Terminal256Formatter(style='paraiso-dark')
def __init__(self, config): super().__init__(config) self.bot_identifier = self.build_identifier('Err') # create window and components self.md = xhtml() self.app = ChatApplication(self)
def __init__(self, config): super().__init__(config) # create window and components self.md = xhtml() self.app = ChatApplication(self)
def __init__(self, config): super().__init__(config) self.bot_identifier = self.build_identifier("Err") # create window and components self.app = ChatApplication(sys.argv, backend=self, config=self.bot_config) self.md = xhtml()