parent
ec92aaba05
commit
c670d48622
@ -188,10 +188,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
elseif fields.delete then
|
||||
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] then -- inbox table
|
||||
mail.delete_mail(name, mail.selected_idxs.inbox[name])
|
||||
mail.selected_idxs.inbox[name] = {}
|
||||
elseif formname == "mail:sent" and mail.selected_idxs.sent[name] then -- sent table
|
||||
mail.delete_mail(name, mail.selected_idxs.sent[name])
|
||||
mail.selected_idxs.sent[name] = {}
|
||||
elseif formname == "mail:drafts" and messagesDrafts[mail.selected_idxs.drafts[name]] then -- drafts table
|
||||
mail.delete_mail(name, messagesDrafts[mail.selected_idxs.drafts[name]].id)
|
||||
mail.selected_idxs.drafts[name] = nil
|
||||
end
|
||||
|
||||
mail.show_mail_menu(name, sortfieldindex, sortdirection, filter)
|
||||
|
16
ui/inbox.lua
16
ui/inbox.lua
@ -104,5 +104,21 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
||||
else
|
||||
formspec[#formspec + 1] = "]label[2.25,4.5;" .. S("No mail") .. "]"
|
||||
end
|
||||
|
||||
if mail.selected_idxs.inbox[name] and #mail.selected_idxs.inbox[name] > 0 then
|
||||
for i, selected_msg in ipairs(mail.selected_idxs.inbox[name]) do
|
||||
local is_present = false
|
||||
for _, msg in ipairs(messages) do
|
||||
if msg.id == selected_msg then
|
||||
is_present = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not is_present then
|
||||
table.remove(mail.selected_idxs.inbox[name], i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.show_formspec(name, "mail:inbox", table.concat(formspec, ""))
|
||||
end
|
||||
|
@ -83,5 +83,21 @@ function mail.show_sent(name, sortfieldindex, sortdirection, filter)
|
||||
else
|
||||
formspec[#formspec + 1] = "]label[2.25,4.5;" .. S("No mail") .. "]"
|
||||
end
|
||||
|
||||
if mail.selected_idxs.sent[name] and #mail.selected_idxs.sent[name] > 0 then
|
||||
for i, selected_msg in ipairs(mail.selected_idxs.sent[name]) do
|
||||
local is_present = false
|
||||
for _, msg in ipairs(messages) do
|
||||
if msg.id == selected_msg then
|
||||
is_present = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not is_present then
|
||||
table.remove(mail.selected_idxs.sent[name], i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.show_formspec(name, "mail:sent", table.concat(formspec, ""))
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user