Пример #1
0
    def __init__(self):
        '''
        Load the core modules, as well as the user defined
        extra modules defined in the config file (config.conf).
        '''

        self.enabled = True

        self.mcore = {}
        self.mextra = []
        self.mplugin = []
        self.cmdlist = {}
        self.cfg = ''

        import module.core.configmanager as cfg

        self.cfg = cfg.BrunobotConfig()
        self.cfg.printConfig()
        self.mcore['cfg'] = self.cfg

        # setting configuration for the output object
        out.setcfg(self.mcore['cfg'])

        self.loadCore()

        out.info('Core modules loaded ')
        for module in self.mcore:
            out.info('%s' % module)
        out.newline()

        import module.core.loadmodule as loadmodule
        self.moduleLoader = loadmodule.DynamicLoad(self)

        for module in self.cfg.list('modules'):
            thread.start_new_thread(self.loadModule, (module, ) )
Пример #2
0
    def connect(self):
        
        self.irc = socket.socket()

        # Trying to bind vhost
        if self.ipaddr:
            try: 
                self.irc.bind((self.ipaddr, self.port))
                out.info("bound IP-address: %s " % self.ipaddr)
            except: 
                out.warn("could not bind IP-address: %s " % self.ipaddr)


        self.irc.connect((self.server, self.port))
        self.irc.send(u'NICK %s\n' % (self.nick))
        self.irc.send(u'USER %s %s bla :%s\n' % (self.ident, self.server, self.name))

        for channel in self.channels:
            self.irc.send(u'JOIN #%s\n' % channel)

        out.info("Connected to %s" % self.server)
        out.newline()

        self.connected = True
        stayawake = self.StayAwake(self)
        stayawake.start()
Пример #3
0
    def __init__(self):
        '''
        Load the core modules, as well as the user defined
        extra modules defined in the config file (config.conf).
        '''

        self.enabled = True

        self.mcore = {}
        self.mextra = []
        self.mplugin = []
        self.cmdlist = {}
        self.cfg = ''

        import module.core.configmanager as cfg

        self.cfg = cfg.BrunobotConfig()
        self.cfg.printConfig()
        self.mcore['cfg'] = self.cfg

        # setting configuration for the output object
        out.setcfg(self.mcore['cfg'])

        self.loadCore()

        out.info('Core modules loaded ')
        for module in self.mcore:
            out.info('%s' % module)
        out.newline()

        import module.core.loadmodule as loadmodule
        self.moduleLoader = loadmodule.DynamicLoad(self)

        for module in self.cfg.list('modules'):
            thread.start_new_thread(self.loadModule, (module, ) )
Пример #4
0
    def connect(self):
        
        self.irc = socket.socket()

        # Trying to bind vhost
        if self.ipaddr:
            try: 
                self.irc.bind((self.ipaddr, self.port))
                out.info("bound IP-address: %s " % self.ipaddr)
            except: 
                out.warn("could not bind IP-address: %s " % self.ipaddr)


        self.irc.connect((self.server, self.port))
        self.irc.send(u'NICK %s\n' % (self.nick))
        self.irc.send(u'USER %s %s bla :%s\n' % (self.ident, self.server, self.name))

        for channel in self.channels:
            self.irc.send(u'JOIN #%s\n' % channel)

        out.info("Connected to %s" % self.server)
        out.newline()

        self.connected = True
        stayawake = self.StayAwake(self)
        stayawake.start()
Пример #5
0
    def quit(self, message=None):
        '''
        quit(string)

        Closes the IRC socket, and stops all the threads that are 
        running making the program come to a natural stop.  
        '''
        out.newline()
        self.mcore['connection'].quit()
        self.mcore['parser'].breader.running = False
        self.mcore['threadmanager'].stop()
        self.enabled = False
Пример #6
0
    def quit(self, message=None):
        '''
        quit(string)

        Closes the IRC socket, and stops all the threads that are 
        running making the program come to a natural stop.  
        '''
        out.newline()
        self.mcore['connection'].quit()
        self.mcore['parser'].breader.running = False
        self.mcore['threadmanager'].stop()
        self.enabled = False
Пример #7
0
def main(modules, data):
    argv          = data['argv']
    channel       = data['channel']
    connection    = modules.mcore['connection']
    auth          = modules.mcore['auth']
    user          = data['nick']
    ident         = data['ident']
    host          = data['host']

    if auth.isOwner(user, ident, host):
        try:
            #connection.connected = False
            #connection.irc.send(u'QUIT \n')
            #connection.quit()
            modules.quit()
            out.info('Bot is shutting down by request of: %s!%s@%s' % (user, ident, host))
            out.newline()
        except:
            ''' Nothing '''
Пример #8
0
def main(modules, data):
    argv = data['argv']
    channel = data['channel']
    connection = modules.mcore['connection']
    auth = modules.mcore['auth']
    user = data['nick']
    ident = data['ident']
    host = data['host']

    if auth.isOwner(user, ident, host):
        try:
            #connection.connected = False
            #connection.irc.send(u'QUIT \n')
            #connection.quit()
            modules.quit()
            out.info('Bot is shutting down by request of: %s!%s@%s' %
                     (user, ident, host))
            out.newline()
        except:
            ''' Nothing '''
Пример #9
0
 def printConfig(self):
     out.info("Configuration [connection]")
     out.info("       server:   %s (%s)" % (self.get('connection','server'),self.get('connection','port')))
     out.info("         nick:   %s (%s, %s)" % (self.get('connection','nick'),
                              self.get('connection','ident'),
                              self.get('connection','name')))
     out.info("     channels:   %s " % ", ".join(self.list('channels')))
     out.newline()
     out.info("Configuration [module]")
     out.info(" max_run_time:   %s" % (self.get('module','max_run_time')))
     out.info("       prefix:   %s" % (self.get('module','prefix')))
     for module in self.list('modules'):
         out.info("        module:   %s" % module)
     out.newline()
     out.info("Configuration [owners]")
     for owner in self.list('owners'):
         user, ident, host = owner.replace(' ','').split(',')
         out.info("        owner:   %s!%s@%s" % (user, ident, host))
     out.newline()