From 698e8617c7c3bbd6259fd6eccaec242f8451adac Mon Sep 17 00:00:00 2001 From: Athozus Date: Wed, 1 Mar 2023 18:30:39 +0100 Subject: [PATCH] Add ability to choose default status (to/cc/bcc) Signed-off-by: Athozus --- .storage.lua.kate-swp | Bin 0 -> 63 bytes gui.lua | 2 +- storage.lua | 9 +++++---- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 .storage.lua.kate-swp diff --git a/.storage.lua.kate-swp b/.storage.lua.kate-swp new file mode 100644 index 0000000000000000000000000000000000000000..03eb306ba4c8c3dad88f70aeae9b853c70a58243 GIT binary patch literal 63 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vn5%P-r*53B~#$S$)+$#@>o9v#N#2xGj PlsOH=szA(iy4@83Q>_xr literal 0 HcmV?d00001 diff --git a/gui.lua b/gui.lua index 980c100..f98d9b6 100644 --- a/gui.lua +++ b/gui.lua @@ -888,7 +888,7 @@ function mail.handle_receivefields(player, formname, fields) elseif fields.new then 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 mail.show_edit_maillist( diff --git a/storage.lua b/storage.lua index 6c7c0dc..124a5ef 100644 --- a/storage.lua +++ b/storage.lua @@ -196,11 +196,12 @@ function mail.addMaillist(maillist, players_string) end table.insert(maillists, 1, maillist) if mail.write_json_file(mail.maildir .. "/mail.maillists.json", maillists) then - -- add default status for players contained in the maillist - local players = mail.split(players_string,",") + -- add status for players contained in the maillist + local players = mail.split(players_string,"\n") for _, player in ipairs(players) do - if minetest.player_exists(player) then -- avoid blank names - mail.addPlayerToMaillist(player, maillist.id, "to") + local playerInfo = mail.split(player, " ") + if minetest.player_exists(playerInfo[1]) then -- avoid blank names + mail.addPlayerToMaillist(playerInfo[1], maillist.id, playerInfo[2]) end end return true