diff options
author | Diego Martinez <kaeza@users.sf.net> | 2014-06-26 03:17:40 -0300 |
---|---|---|
committer | Diego Martinez <kaeza@users.sf.net> | 2014-06-26 06:52:38 -0300 |
commit | ed621c5ce02a340890e45b2f86a7969f0cfdcd6d (patch) | |
tree | 1f125cd42e0e59cf2a2f0d5eba8563a0d0b66125 /importers | |
parent | 75c1be2f8e3f3293b449ed07555bbd8a6d40e356 (diff) | |
download | xban2-ed621c5ce02a340890e45b2f86a7969f0cfdcd6d.tar.gz xban2-ed621c5ce02a340890e45b2f86a7969f0cfdcd6d.tar.bz2 xban2-ed621c5ce02a340890e45b2f86a7969f0cfdcd6d.zip |
Add v2 database importer.
Diffstat (limited to 'importers')
-rw-r--r-- | importers/v2.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/importers/v2.lua b/importers/v2.lua new file mode 100644 index 0000000..fd29966 --- /dev/null +++ b/importers/v2.lua @@ -0,0 +1,35 @@ + +function xban.importers.v2() + return pcall(function() + local f, e = io.open(minetest.get_worldpath().."/players.iplist.v2") + if not f then + error("Unable to open `players.iplist.v2': "..e) + end + local text = f:read("*a") + f:close() + local db = minetest.deserialize(text) + for _, e in ipairs(db) do + for name in pairs(e.names) do + local entry = xban.find_entry(name, true) + if entry.source ~= "xban:importer_v2" then + for nm in pairs(e.names) do + entry.names[nm] = true + end + if e.banned then + entry.banned = true + entry.reason = e.banned + entry.source = "xban:importer_v2" + entry.time = e.time + entry.expires = e.expires + table.insert(entry.record, { + source = entry.source, + reason = entry.reason, + time = entry.time, + expires = entry.expires, + }) + end + end + end + end + end) +end |