mirror of
https://github.com/mt-mods/mail.git
synced 2025-03-15 06:01:25 +00:00
Fix an occurrence of get_keys() in is_uuid_existing()
This commit is contained in:
parent
58604e4da1
commit
aa3146dcae
1 changed files with 19 additions and 7 deletions
26
migrate.lua
26
migrate.lua
|
@ -91,17 +91,29 @@ local function search_box(playername, box, uuid)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function search_boxes(playername, boxes, uuid)
|
||||||
|
local result
|
||||||
|
for _, b in ipairs(boxes) do
|
||||||
|
result = search_box(playername, b, uuid)
|
||||||
|
if result then return result end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function is_uuid_existing(uuid)
|
local function is_uuid_existing(uuid)
|
||||||
for _, k in ipairs(mail.storage:get_keys()) do
|
local boxes = {"inbox", "outbox", "drafts", "trash"}
|
||||||
if string.sub(k,1,5) == "mail/" then
|
if mail.storage.get_keys then
|
||||||
local p = string.sub(k, 6)
|
for _, k in ipairs(mail.storage:get_keys()) do
|
||||||
local result
|
if string.sub(k,1,5) == "mail/" then
|
||||||
local boxes = {"inbox", "outbox", "drafts", "trash"}
|
local p = string.sub(k, 6)
|
||||||
for _, b in ipairs(boxes) do
|
local result = search_boxes(p, boxes, uuid)
|
||||||
result = search_box(p, b, uuid)
|
|
||||||
if result then return result end
|
if result then return result end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
for p, _ in minetest.get_auth_handler().iterate() do
|
||||||
|
local result = search_boxes(p, boxes, uuid)
|
||||||
|
if result then return result end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue