Exemple #1
0
class TestConfigurationManager(unittest.TestCase):
    def setUp(self):
        self.cm = ConfigurationManager()
    
    def testReadConnections(self):
        self.cm.read_config('settings-test.py')
        self.assertEquals(len(self.cm.list_connections()), 2)
        for conn in self.cm.list_connections():
            assert(conn.has_key('endpoint'))
            assert(conn.has_key('channels'))
Exemple #2
0
class Dickler(object):
   
    def __init__(self, configuration):
        self.identity = None
        self.configuration = configuration
        self.connections = set([])
        self.configmanager = ConfigurationManager()
              
    def connect(self):
        if not self.configmanager.read_config(self.configuration):
            return False
            
        for conn in self.configmanager.list_connections():
            c = IRCConnection(conn, self.configmanager.get_identity())
            #for plugin, conf in self.configmanager.list_plugins():
                #c.msg_handler.register_plugin(plugin.create_plugin(c, conf))
            self.connections.add(c)
        
        for conn in self.connections:
            conn.make_connection()
            conn.start()
        
        return True