Ejemplo n.º 1
0
    def set_channel(self, channel_window):
        log.debug('setting channel to {0}'.format(channel_window))
        if self.current_channel is not None:
            self.channel_box.remove(self.current_channel)

        self.current_channel = channel_window
        self.channel_box.pack_start(channel_window, expand=True, fill=True, padding=0)
Ejemplo n.º 2
0
    def on_message(self, network, channel):
        log.debug('in on_message')
        if network.name in self.network_channels and channel.name in self.network_channels[network.name]:
            channel_window = self.network_channels[network.name][channel.name]
            channel_window.on_message(network, channel)

        else:
            log.warning('message for unknown channel {0}'.format(channel.name))
Ejemplo n.º 3
0
    def on_new_channel(self, network, channel):
        log.debug('in on_new_channel')
        if network.name not in self.network_channels:
            self.network_channels[network.name] = {}

        if channel.name not in self.network_channels[network.name]:
            channel_window = ChannelWindow(network, channel)
            self.network_channels[network.name][channel.name] = channel_window

        if self.current_channel is None:
            self.set_channel(channel_window)
Ejemplo n.º 4
0
    def run(self):
        self.irc = IRC()
        self.irc.add_global_handler(event='all_events', handler=self.process_events, priority=-1)
        self.network_config = Dotfile('networks', use_defaults=False)
        self.connections = {}
        self.networks = {}

        log.info('starting engine')

        irc_thread = threading.Thread(target=self.process_irc)
        irc_thread.start()

        command_thread = threading.Thread(target=self.process_commands)
        command_thread.start()

        while command_thread.is_alive():
            command_thread.join()
        log.debug('command_thread stopped')

        while irc_thread.is_alive():
            irc_thread.join()
        log.debug('irc_thread stopped')

        async_ui_message('stopped')