mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-05 06:00:29 -04:00
Add ability to choose default status (to/cc/bcc)
Signed-off-by: Athozus <athozus@gmail.com>
This commit is contained in:
parent
2656936a6f
commit
698e8617c7
3 changed files with 6 additions and 5 deletions
BIN
.storage.lua.kate-swp
Normal file
BIN
.storage.lua.kate-swp
Normal file
Binary file not shown.
2
gui.lua
2
gui.lua
|
@ -888,7 +888,7 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
|
|
||||||
elseif fields.new then
|
elseif fields.new then
|
||||||
selected_idxs.maillists[name] = "#NEW#"
|
selected_idxs.maillists[name] = "#NEW#"
|
||||||
mail.show_edit_maillist(name, "", "", "")
|
mail.show_edit_maillist(name, "", "", "Player1 to\nPlayer2 cc\nPlayer3 bcc")
|
||||||
|
|
||||||
elseif fields.edit and selected_idxs.maillists[name] and maillists[selected_idxs.maillists[name]] then
|
elseif fields.edit and selected_idxs.maillists[name] and maillists[selected_idxs.maillists[name]] then
|
||||||
mail.show_edit_maillist(
|
mail.show_edit_maillist(
|
||||||
|
|
|
@ -196,11 +196,12 @@ function mail.addMaillist(maillist, players_string)
|
||||||
end
|
end
|
||||||
table.insert(maillists, 1, maillist)
|
table.insert(maillists, 1, maillist)
|
||||||
if mail.write_json_file(mail.maildir .. "/mail.maillists.json", maillists) then
|
if mail.write_json_file(mail.maildir .. "/mail.maillists.json", maillists) then
|
||||||
-- add default status for players contained in the maillist
|
-- add status for players contained in the maillist
|
||||||
local players = mail.split(players_string,",")
|
local players = mail.split(players_string,"\n")
|
||||||
for _, player in ipairs(players) do
|
for _, player in ipairs(players) do
|
||||||
if minetest.player_exists(player) then -- avoid blank names
|
local playerInfo = mail.split(player, " ")
|
||||||
mail.addPlayerToMaillist(player, maillist.id, "to")
|
if minetest.player_exists(playerInfo[1]) then -- avoid blank names
|
||||||
|
mail.addPlayerToMaillist(playerInfo[1], maillist.id, playerInfo[2])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue