2023-04-10 15:16:23 +03:00
|
|
|
|
|
|
|
-- Getter to filter and sort messages on demand
|
|
|
|
local function messageGetter(messages, sortfield, ascending, filter)
|
|
|
|
local results
|
|
|
|
return function()
|
|
|
|
if not results then
|
|
|
|
results = mail.sort_messages(messages, sortfield, ascending, filter)
|
|
|
|
end
|
|
|
|
return results
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-04-30 23:19:22 +03:00
|
|
|
local function nonempty(x)
|
|
|
|
return ((type(x)=="table")and(#x>0))
|
|
|
|
end
|
|
|
|
|
2023-03-29 18:25:01 +03:00
|
|
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
2023-06-15 20:28:04 +03:00
|
|
|
if formname ~= "mail:inbox" and formname ~= "mail:outbox"
|
|
|
|
and formname ~= "mail:drafts" and formname ~= "mail:trash" then
|
2023-03-29 18:25:01 +03:00
|
|
|
return
|
2023-04-15 13:54:12 +03:00
|
|
|
elseif fields.quit then
|
|
|
|
return
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
|
2023-04-10 15:16:23 +03:00
|
|
|
-- Get player name and handle / convert common input fields
|
2023-03-29 18:25:01 +03:00
|
|
|
local name = player:get_player_name()
|
2023-06-16 18:39:10 +03:00
|
|
|
local filter = (fields.search and fields.filter) or mail.selected_idxs.filter[name] or ""
|
2023-04-10 15:16:23 +03:00
|
|
|
local sortfieldindex = tonumber(fields.sortfield or mail.selected_idxs.sortfield[name]) or 3
|
|
|
|
local sortdirection = fields.sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
|
|
|
local inboxsortfield = ({"from","subject","time"})[sortfieldindex]
|
|
|
|
local outboxsortfield = ({"to","subject","time"})[sortfieldindex]
|
|
|
|
|
2023-04-12 18:08:34 +03:00
|
|
|
-- Be sure that inbox/outbox selected idxs aren't nil
|
|
|
|
mail.selected_idxs.inbox[name] = mail.selected_idxs.inbox[name] or {}
|
2023-06-04 03:03:14 +03:00
|
|
|
mail.selected_idxs.outbox[name] = mail.selected_idxs.outbox[name] or {}
|
2023-04-12 18:08:34 +03:00
|
|
|
|
2023-04-10 15:16:23 +03:00
|
|
|
-- Store common player configuration for reuse
|
|
|
|
mail.selected_idxs.sortfield[name] = sortfieldindex
|
|
|
|
mail.selected_idxs.sortdirection[name] = sortdirection
|
2023-04-12 18:08:34 +03:00
|
|
|
mail.selected_idxs.filter[name] = filter
|
|
|
|
if fields.multipleselection then
|
|
|
|
mail.selected_idxs.multipleselection[name] = fields.multipleselection == "true"
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Avoid several selected after disabling the multiple selection
|
|
|
|
if not mail.selected_idxs.multipleselection[name] then
|
|
|
|
mail.selected_idxs.inbox[name] = { mail.selected_idxs.inbox[name][#mail.selected_idxs.inbox[name]] }
|
2023-06-04 03:03:14 +03:00
|
|
|
mail.selected_idxs.outbox[name] = { mail.selected_idxs.outbox[name][#mail.selected_idxs.outbox[name]] }
|
2023-04-12 18:08:34 +03:00
|
|
|
end
|
2023-03-29 18:25:01 +03:00
|
|
|
|
2023-06-04 03:03:14 +03:00
|
|
|
-- split inbox and outbox msgs for different tests
|
2023-03-29 18:25:01 +03:00
|
|
|
local entry = mail.get_storage_entry(name)
|
2023-03-31 18:14:52 +03:00
|
|
|
local messagesDrafts = entry.drafts
|
2023-06-15 20:28:04 +03:00
|
|
|
local messagesTrash = entry.trash
|
2023-04-10 15:16:23 +03:00
|
|
|
local getInbox = messageGetter(entry.inbox, inboxsortfield, sortdirection == "2", filter)
|
|
|
|
local getOutbox = messageGetter(entry.outbox, outboxsortfield, sortdirection == "2", filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
2023-04-10 15:16:23 +03:00
|
|
|
-- Hanmdle formspec event
|
2023-03-29 18:25:01 +03:00
|
|
|
if fields.inbox then -- inbox table
|
|
|
|
local evt = minetest.explode_table_event(fields.inbox)
|
2023-04-15 13:54:12 +03:00
|
|
|
if evt.row == 1 then -- header
|
|
|
|
if mail.selected_idxs.sortfield[name] == evt.column-1 then -- if already this field, then change direction
|
|
|
|
mail.selected_idxs.sortdirection[name] = mail.selected_idxs.sortdirection[name] == "2" and "1" or "2"
|
|
|
|
end
|
|
|
|
mail.selected_idxs.sortfield[name] = evt.column-1 -- update column
|
|
|
|
mail.show_mail_menu(name)
|
|
|
|
return
|
|
|
|
end
|
2023-04-12 18:08:34 +03:00
|
|
|
if mail.selected_idxs.multipleselection[name] then
|
|
|
|
if not mail.selected_idxs.inbox[name] then
|
|
|
|
mail.selected_idxs.inbox[name] = {}
|
|
|
|
end
|
|
|
|
local selected_id = 0
|
|
|
|
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
|
|
|
|
if getInbox()[evt.row-1].id == selected_msg then
|
|
|
|
selected_id = i
|
|
|
|
table.remove(mail.selected_idxs.inbox[name], i)
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if selected_id == 0 then
|
|
|
|
table.insert(mail.selected_idxs.inbox[name], getInbox()[evt.row-1].id)
|
|
|
|
end
|
|
|
|
else
|
2023-06-16 18:39:10 +03:00
|
|
|
mail.selected_idxs.inbox[name] = { (getInbox()[evt.row-1] or {}).id }
|
2023-04-12 18:08:34 +03:00
|
|
|
end
|
|
|
|
if evt.type == "DCL" and getInbox()[evt.row-1] then
|
|
|
|
mail.show_message(name, getInbox()[evt.row-1].id)
|
|
|
|
else
|
|
|
|
mail.show_mail_menu(name)
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2023-06-04 03:03:14 +03:00
|
|
|
if fields.outbox then -- outbox table
|
|
|
|
local evt = minetest.explode_table_event(fields.outbox)
|
2023-04-15 13:54:12 +03:00
|
|
|
if evt.row == 1 then -- header
|
|
|
|
if mail.selected_idxs.sortfield[name] == evt.column-1 then -- if already this field, then change direction
|
|
|
|
mail.selected_idxs.sortdirection[name] = mail.selected_idxs.sortdirection[name] == "2" and "1" or "2"
|
|
|
|
end
|
|
|
|
mail.selected_idxs.sortfield[name] = evt.column-1 -- update column
|
|
|
|
mail.show_mail_menu(name)
|
|
|
|
return
|
|
|
|
end
|
2023-04-12 18:08:34 +03:00
|
|
|
if mail.selected_idxs.multipleselection[name] then
|
2023-06-04 03:03:14 +03:00
|
|
|
if not mail.selected_idxs.outbox[name] then
|
|
|
|
mail.selected_idxs.outbox[name] = {}
|
2023-04-12 18:08:34 +03:00
|
|
|
end
|
|
|
|
local selected_id = 0
|
2023-06-04 03:03:14 +03:00
|
|
|
if mail.selected_idxs.outbox[name] and #mail.selected_idxs.outbox[name] > 0 then
|
|
|
|
for i, selected_msg in ipairs(mail.selected_idxs.outbox[name]) do
|
2023-04-12 18:08:34 +03:00
|
|
|
if getOutbox()[evt.row-1].id == selected_msg then
|
|
|
|
selected_id = i
|
2023-06-04 03:03:14 +03:00
|
|
|
table.remove(mail.selected_idxs.outbox[name], i)
|
2023-04-12 18:08:34 +03:00
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if selected_id == 0 then
|
2023-06-04 03:03:14 +03:00
|
|
|
table.insert(mail.selected_idxs.outbox[name], getOutbox()[evt.row-1].id)
|
2023-04-12 18:08:34 +03:00
|
|
|
end
|
|
|
|
else
|
2023-06-16 18:39:10 +03:00
|
|
|
mail.selected_idxs.outbox[name] = { (getOutbox()[evt.row-1] or {}).id }
|
2023-04-12 18:08:34 +03:00
|
|
|
end
|
|
|
|
if evt.type == "DCL" and getOutbox()[evt.row-1] then
|
|
|
|
mail.show_message(name, getOutbox()[evt.row-1].id)
|
|
|
|
else
|
|
|
|
mail.show_mail_menu(name)
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2023-03-31 18:14:52 +03:00
|
|
|
if fields.drafts then -- drafts table
|
|
|
|
local evt = minetest.explode_table_event(fields.drafts)
|
2023-04-15 13:54:12 +03:00
|
|
|
if evt.row == 1 then -- header
|
|
|
|
if mail.selected_idxs.sortfield[name] == evt.column-1 then -- if already this field, then change direction
|
|
|
|
mail.selected_idxs.sortdirection[name] = mail.selected_idxs.sortdirection[name] == "2" and "1" or "2"
|
|
|
|
end
|
|
|
|
mail.selected_idxs.sortfield[name] = evt.column-1 -- update column
|
|
|
|
mail.show_mail_menu(name)
|
|
|
|
return
|
|
|
|
end
|
2023-03-31 18:14:52 +03:00
|
|
|
mail.selected_idxs.drafts[name] = evt.row - 1
|
|
|
|
if evt.type == "DCL" and messagesDrafts[mail.selected_idxs.drafts[name]] then
|
|
|
|
mail.show_compose(name,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].to,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].subject,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].body,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].cc,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].bcc,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].id
|
|
|
|
)
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2023-06-15 20:28:04 +03:00
|
|
|
if fields.trash then -- trash table
|
|
|
|
local evt = minetest.explode_table_event(fields.trash)
|
|
|
|
if evt.row == 1 then -- header
|
|
|
|
if mail.selected_idxs.sortfield[name] == evt.column-1 then -- if already this field, then change direction
|
|
|
|
mail.selected_idxs.sortdirection[name] = mail.selected_idxs.sortdirection[name] == "2" and "1" or "2"
|
|
|
|
end
|
|
|
|
mail.selected_idxs.sortfield[name] = evt.column-1 -- update column
|
|
|
|
mail.show_mail_menu(name)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
mail.selected_idxs.trash[name] = evt.row - 1
|
|
|
|
if evt.type == "DCL" and messagesTrash[mail.selected_idxs.trash[name]] then
|
|
|
|
mail.show_message(name, messagesTrash[mail.selected_idxs.trash[name]].id)
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2023-03-29 18:25:01 +03:00
|
|
|
if fields.boxtab == "1" then
|
|
|
|
mail.selected_idxs.boxtab[name] = 1
|
2023-04-10 15:16:23 +03:00
|
|
|
mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
|
|
|
elseif fields.boxtab == "2" then
|
|
|
|
mail.selected_idxs.boxtab[name] = 2
|
2023-06-04 03:03:14 +03:00
|
|
|
mail.show_outbox(name, sortfieldindex, sortdirection, filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
2023-03-31 18:14:52 +03:00
|
|
|
elseif fields.boxtab == "3" then
|
|
|
|
mail.selected_idxs.boxtab[name] = 3
|
|
|
|
mail.show_drafts(name)
|
|
|
|
|
2023-06-15 20:28:04 +03:00
|
|
|
elseif fields.boxtab == "4" then
|
|
|
|
mail.selected_idxs.boxtab[name] = 4
|
|
|
|
mail.show_trash(name)
|
|
|
|
|
2023-03-29 18:25:01 +03:00
|
|
|
elseif fields.read then
|
2023-04-30 23:19:22 +03:00
|
|
|
if formname == "mail:inbox" and nonempty(mail.selected_idxs.inbox[name]) then -- inbox table
|
2023-04-12 18:08:34 +03:00
|
|
|
mail.show_message(name, mail.selected_idxs.inbox[name][#mail.selected_idxs.inbox[name]])
|
2023-06-04 03:03:14 +03:00
|
|
|
elseif formname == "mail:outbox" and nonempty(mail.selected_idxs.outbox[name]) then -- outbox table
|
|
|
|
mail.show_message(name, mail.selected_idxs.outbox[name][#mail.selected_idxs.outbox[name]])
|
2023-06-15 20:28:04 +03:00
|
|
|
elseif formname == "mail:trash" and messagesTrash[mail.selected_idxs.trash[name]] then
|
|
|
|
mail.show_message(name, messagesTrash[mail.selected_idxs.trash[name]].id)
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
|
2023-03-31 19:08:51 +03:00
|
|
|
elseif fields.edit then
|
|
|
|
if formname == "mail:drafts" and messagesDrafts[mail.selected_idxs.drafts[name]] then
|
|
|
|
mail.show_compose(name,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].to,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].subject,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].body,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].cc,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].bcc,
|
|
|
|
messagesDrafts[mail.selected_idxs.drafts[name]].id
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2023-03-29 18:25:01 +03:00
|
|
|
elseif fields.delete then
|
2023-06-15 20:28:04 +03:00
|
|
|
local trash_enabled = mail.get_setting(name, "trash_move_enable")
|
2023-04-12 18:08:34 +03:00
|
|
|
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] then -- inbox table
|
2023-06-15 20:28:04 +03:00
|
|
|
if trash_enabled then
|
|
|
|
mail.trash_mail(name, mail.selected_idxs.inbox[name])
|
|
|
|
else
|
|
|
|
mail.delete_mail(name, mail.selected_idxs.inbox[name])
|
|
|
|
end
|
2023-05-02 11:38:08 +03:00
|
|
|
mail.selected_idxs.inbox[name] = {}
|
2023-06-04 03:03:14 +03:00
|
|
|
elseif formname == "mail:outbox" and mail.selected_idxs.outbox[name] then -- outbox table
|
2023-06-15 20:28:04 +03:00
|
|
|
if trash_enabled then
|
|
|
|
mail.trash_mail(name, mail.selected_idxs.outbox[name])
|
|
|
|
else
|
|
|
|
mail.delete_mail(name, mail.selected_idxs.outbox[name])
|
|
|
|
end
|
2023-06-04 03:03:14 +03:00
|
|
|
mail.selected_idxs.outbox[name] = {}
|
2023-03-31 18:14:52 +03:00
|
|
|
elseif formname == "mail:drafts" and messagesDrafts[mail.selected_idxs.drafts[name]] then -- drafts table
|
2023-06-15 20:28:04 +03:00
|
|
|
if trash_enabled then
|
|
|
|
mail.trash_mail(name, messagesDrafts[mail.selected_idxs.drafts[name]].id)
|
|
|
|
else
|
|
|
|
mail.delete_mail(name, messagesDrafts[mail.selected_idxs.drafts[name]].id)
|
|
|
|
end
|
2023-05-02 11:38:08 +03:00
|
|
|
mail.selected_idxs.drafts[name] = nil
|
2023-06-15 20:28:04 +03:00
|
|
|
|
|
|
|
elseif formname == "mail:trash" and messagesTrash[mail.selected_idxs.trash[name]] then -- trash table
|
|
|
|
mail.delete_mail(name, messagesTrash[mail.selected_idxs.trash[name]].id, true)
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
|
2023-04-10 15:16:23 +03:00
|
|
|
mail.show_mail_menu(name, sortfieldindex, sortdirection, filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
2023-06-15 20:28:04 +03:00
|
|
|
elseif fields.restore then
|
2023-06-18 20:06:12 +03:00
|
|
|
if messagesTrash[mail.selected_idxs.trash[name]] then
|
|
|
|
mail.restore_mail(name, messagesTrash[mail.selected_idxs.trash[name]].id)
|
|
|
|
end
|
2023-06-15 20:28:04 +03:00
|
|
|
mail.show_mail_menu(name, sortfieldindex, sortdirection, filter)
|
|
|
|
|
2023-03-29 18:25:01 +03:00
|
|
|
elseif fields.reply then
|
2023-04-26 13:11:27 +03:00
|
|
|
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] and #mail.selected_idxs.inbox[name] > 0 then
|
2023-04-12 18:08:34 +03:00
|
|
|
local message = mail.get_message(name, mail.selected_idxs.inbox[name][#mail.selected_idxs.inbox[name]])
|
2023-03-29 18:25:01 +03:00
|
|
|
mail.reply(name, message)
|
2023-06-04 03:03:14 +03:00
|
|
|
elseif
|
|
|
|
formname == "mail:outbox" and mail.selected_idxs.outbox[name] and #mail.selected_idxs.outbox[name] > 0 then
|
|
|
|
local message = mail.get_message(name, mail.selected_idxs.outbox[name][#mail.selected_idxs.outbox[name]])
|
2023-03-29 18:25:01 +03:00
|
|
|
mail.reply(name, message)
|
|
|
|
end
|
|
|
|
|
|
|
|
elseif fields.replyall then
|
2023-04-26 13:11:27 +03:00
|
|
|
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] and #mail.selected_idxs.inbox[name] > 0 then
|
2023-04-12 18:08:34 +03:00
|
|
|
local message = mail.get_message(name, mail.selected_idxs.inbox[name][#mail.selected_idxs.inbox[name]])
|
2023-03-29 18:25:01 +03:00
|
|
|
mail.replyall(name, message)
|
2023-06-04 03:03:14 +03:00
|
|
|
elseif
|
|
|
|
formname == "mail:outbox" and mail.selected_idxs.outbox[name] and #mail.selected_idxs.outbox[name] > 0 then
|
|
|
|
local message = mail.get_message(name, mail.selected_idxs.outbox[name][#mail.selected_idxs.outbox[name]])
|
2023-03-29 18:25:01 +03:00
|
|
|
mail.replyall(name, message)
|
|
|
|
end
|
|
|
|
|
|
|
|
elseif fields.forward then
|
2023-04-26 13:11:27 +03:00
|
|
|
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] and #mail.selected_idxs.inbox[name] > 0 then
|
2023-04-12 18:08:34 +03:00
|
|
|
local message = mail.get_message(name, mail.selected_idxs.inbox[name][#mail.selected_idxs.inbox[name]])
|
2023-03-29 18:25:01 +03:00
|
|
|
mail.forward(name, message)
|
2023-06-04 03:03:14 +03:00
|
|
|
elseif
|
|
|
|
formname == "mail:outbox" and mail.selected_idxs.outbox[name] and #mail.selected_idxs.outbox[name] > 0 then
|
|
|
|
local message = mail.get_message(name, mail.selected_idxs.outbox[name][#mail.selected_idxs.outbox[name]])
|
2023-03-29 18:25:01 +03:00
|
|
|
mail.forward(name, message)
|
|
|
|
end
|
|
|
|
|
|
|
|
elseif fields.markread then
|
2023-04-12 18:08:34 +03:00
|
|
|
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] then
|
2023-04-15 16:39:36 +03:00
|
|
|
mail.mark_read(name, mail.selected_idxs.inbox[name])
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
|
2023-04-10 15:16:23 +03:00
|
|
|
mail.show_mail_menu(name, sortfieldindex, sortdirection, filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
|
|
|
elseif fields.markunread then
|
2023-04-12 18:08:34 +03:00
|
|
|
if formname == "mail:inbox" and mail.selected_idxs.inbox[name] then
|
2023-04-15 16:39:36 +03:00
|
|
|
mail.mark_unread(name, mail.selected_idxs.inbox[name])
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
|
2023-04-10 15:16:23 +03:00
|
|
|
mail.show_mail_menu(name, sortfieldindex, sortdirection, filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
|
|
|
elseif fields.new then
|
|
|
|
mail.show_compose(name)
|
|
|
|
|
2023-06-20 00:17:11 +03:00
|
|
|
elseif fields.empty then
|
|
|
|
mail.empty_trash(name)
|
|
|
|
mail.show_mail_menu(name)
|
|
|
|
|
2023-03-29 18:25:01 +03:00
|
|
|
elseif fields.contacts then
|
|
|
|
mail.show_contacts(name)
|
|
|
|
|
|
|
|
elseif fields.maillists then
|
|
|
|
mail.show_maillists(name)
|
|
|
|
|
2023-05-05 12:38:19 +03:00
|
|
|
elseif fields.options then
|
|
|
|
mail.show_options(name)
|
2023-03-29 18:25:01 +03:00
|
|
|
|
2023-04-12 18:08:34 +03:00
|
|
|
elseif fields.selectall then
|
|
|
|
if formname == "mail:inbox" then
|
2023-06-18 20:40:11 +03:00
|
|
|
local selected_number = #mail.selected_idxs.inbox[name]
|
2023-05-23 18:49:17 +03:00
|
|
|
mail.selected_idxs.inbox[name] = {} -- reset for select, unselect and not existing
|
|
|
|
mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed
|
2023-06-18 20:40:11 +03:00
|
|
|
if selected_number < #getInbox() then -- then populate it if selection isn't full
|
2023-04-12 18:08:34 +03:00
|
|
|
for _, msg in ipairs(getInbox()) do
|
|
|
|
table.insert(mail.selected_idxs.inbox[name], msg.id)
|
|
|
|
end
|
|
|
|
end
|
2023-06-04 03:03:14 +03:00
|
|
|
elseif formname == "mail:outbox" then
|
2023-06-18 20:40:11 +03:00
|
|
|
local selected_number = #mail.selected_idxs.outbox[name]
|
2023-06-04 03:03:14 +03:00
|
|
|
mail.selected_idxs.outbox[name] = {} -- reset for select, unselect and not existing
|
2023-05-23 18:49:17 +03:00
|
|
|
mail.selected_idxs.multipleselection[name] = true -- enable as the button were pressed
|
2023-06-18 20:40:11 +03:00
|
|
|
if selected_number < #getOutbox() then -- then populate it if selection isn't full
|
2023-04-12 18:08:34 +03:00
|
|
|
for _, msg in ipairs(getOutbox()) do
|
2023-06-04 03:03:14 +03:00
|
|
|
table.insert(mail.selected_idxs.outbox[name], msg.id)
|
2023-04-12 18:08:34 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
mail.show_mail_menu(name)
|
|
|
|
|
2023-04-07 11:19:30 +03:00
|
|
|
elseif fields.sortfield or fields.sortdirection or fields.filter then
|
2023-04-10 15:16:23 +03:00
|
|
|
mail.show_mail_menu(name, sortfieldindex, sortdirection, filter)
|
2023-03-29 18:25:01 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end)
|