summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua38
1 files changed, 4 insertions, 34 deletions
diff --git a/main.lua b/main.lua
index fd0d146..cba7080 100644
--- a/main.lua
+++ b/main.lua
@@ -9,20 +9,20 @@ local pylon_classes = {
}
local Wilson = {}
-function Wilson.make(config)
+function Wilson.make(conf)
local self = {
pylons={},
busses={},
cq = cqueues.new(),
}
- for name, pylon_conf in pairs(config.pylon) do
+ for name, pylon_conf in pairs(conf.pylon) do
pylon_conf.name = name
local pylon_class = pylon_classes[pylon_conf.type]
assert(pylon_class, "no such pylon type "..pylon_conf.type)
self.pylons[name] = pylon_class.make(self, pylon_conf)
print("constructed pylon",name,pylon_conf.type)
end
- for name, bus_conf in pairs(config.bus) do
+ for name, bus_conf in pairs(conf.bus) do
local bus = {}
for _, item in ipairs(bus_conf) do
local pylon_name, channel_descriptor = item[1], item[2]
@@ -61,38 +61,8 @@ function Wilson.run(self)
print('toplevel',self.cq:loop())
end
-local config_file = io.open("wilson.ini","r")
+local config_file = assert(io.open("wilson.ini","r"))
local conf = config.parse(config_file)
config_file:close()
local wilson = Wilson.make(conf)
wilson:run()
-
-
-
-
--- local pylon_confs = {
--- xmpp_ubq323 = {
--- type='xmpp',
--- jid='wilson@ubq323.website',
--- server='localhost',
--- component='wilson.ubq323.website',
--- component_secret='super_secret_wilson_password',
--- resource='wilson',
--- },
--- irc_local = {
--- type='irc',
--- host='localhost',
--- port=6667,
--- password='mypassword',
--- nodename='wilson.ubq323',
--- },
--- }
--- local bus_confs = {
--- d = {
--- {'xmpp_ubq323', 'd@conference.ubq323.website'},
--- {'irc_local', '#test'},
--- },
--- }
-
--- local the_network = Wilson.make(pylon_confs, bus_confs)
--- the_network:run()