config.lua
author Tero Marttila <terom@fixme.fi>
Wed, 01 Apr 2009 01:41:08 +0300
changeset 106 f00661136ac2
child 115 2d74b38b56de
permissions -rw-r--r--
add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
106
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
local conf = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
    log_level   = "DEBUG",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
    name = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
        nickname    = "SpBotDev",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
        username    = "spbot-dev",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     7
        realname    = "SpBot (development version)"
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
    },
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     9
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
    networks = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
        PVLNet      = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
            hostname    = "irc.fixme.fi",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    14
            channels    = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
                "#test"
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16
            }
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
        },
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
    },
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
    modules = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
        irc_log     = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    22
            path        = "src/modules/mod_irc_log.so",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
            conf        = {
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
                db_info     = "dbname=spbot",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26
                channel     = "PVLNet/#test",
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    27
            }
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    28
        }
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    29
    },
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    30
}
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    31
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    32
-- apply general
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    33
log_level(conf.log_level)
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    34
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    35
-- apply conf_name
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    36
client:set_defaults(conf.name.nickname, conf.name.username, conf.name.realname)
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    37
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    38
-- apply conf_networks
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    39
for network, settings in pairs(conf.networks) do
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    40
    -- establish the irc_net
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    41
    net = client:connect(network, settings.hostname)
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    42
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    43
    -- join each channel
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    44
    for i, channel in ipairs(settings.channels) do
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    45
        net:join(channel)
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    46
    end
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    47
end
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    48
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    49
-- apply conf_modules
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    50
for name, settings in pairs(conf.modules) do
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    51
    -- load the module
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    52
    module = modules:load(name, settings.path)
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    53
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    54
    -- apply confs
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    55
    for key, value in pairs(settings.conf) do
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    56
        module:conf(key, value)
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    57
    end
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    58
end
f00661136ac2 add nexus_lua_error for unified LUA_ERR* -> ERR_LUA_* mapping, and lua configuration support
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    59