Fix an occurrence of get_keys() in is_uuid_existing()

This commit is contained in:
Athozus 2024-08-07 15:26:17 +02:00
parent 58604e4da1
commit aa3146dcae
No known key found for this signature in database
GPG Key ID: B50895022E8484BF

View File

@ -91,17 +91,29 @@ local function search_box(playername, box, uuid)
return false
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)
for _, k in ipairs(mail.storage:get_keys()) do
if string.sub(k,1,5) == "mail/" then
local p = string.sub(k, 6)
local result
local boxes = {"inbox", "outbox", "drafts", "trash"}
for _, b in ipairs(boxes) do
result = search_box(p, b, uuid)
local boxes = {"inbox", "outbox", "drafts", "trash"}
if mail.storage.get_keys then
for _, k in ipairs(mail.storage:get_keys()) do
if string.sub(k,1,5) == "mail/" then
local p = string.sub(k, 6)
local result = search_boxes(p, boxes, uuid)
if result then return result 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
return false
end