1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-14 22:40:31 +01:00
server-nalc/mods/xban2/importers/minetest.lua
Ombridride 232b274c55 initial commit
subgame + mods
2014-10-28 18:01:32 +01:00

30 lines
699 B
Lua

function xban.importers.minetest()
local f, e = io.open(minetest.get_worldpath().."/ipban.txt")
if not f then
return false, "Unable to open `ipban.txt': "..e
end
for line in f:lines() do
local ip, name = line:match("([^|]+)%|(.+)")
if ip and name then
local entry
entry = xban.find_entry(ip, true)
entry.banned = true
entry.reason = "Banned in `ipban.txt'"
entry.names[name] = true
entry.names[ip] = true
entry.time = os.time()
entry.expires = nil
entry.source = "xban:importer_minetest"
table.insert(entry.record, {
source = entry.source,
reason = entry.reason,
time = entry.time,
expires = nil,
})
end
end
f:close()
return true
end