revert renaming "sender" to "from" to maintain backwards compatibility

This commit is contained in:
Peter Nerlich 2020-08-12 11:51:01 +02:00
parent 1f5a963d78
commit 8beec340d3
4 changed files with 6 additions and 7 deletions

View File

@ -67,7 +67,7 @@ function mail.send(src, dst, subject, body)
-- form the actual mail
local msg = {
unread = true,
from = m.from,
sender = m.from,
to = m.to,
subject = m.subject,
body = m.body,

10
gui.lua
View File

@ -60,7 +60,7 @@ function mail.show_inbox(name)
end
end
formspec[#formspec + 1] = ","
formspec[#formspec + 1] = minetest.formspec_escape(message.from)
formspec[#formspec + 1] = minetest.formspec_escape(message.sender)
formspec[#formspec + 1] = ","
if message.subject ~= "" then
if string.len(message.subject) > 30 then
@ -102,7 +102,7 @@ function mail.show_message(name, msgnumber)
button[6,8.5;2,1;delete;Delete]
]] .. theme
local from = minetest.formspec_escape(message.from)
local from = minetest.formspec_escape(message.sender)
local to = minetest.formspec_escape(message.to)
local cc = minetest.formspec_escape(message.cc)
local subject = minetest.formspec_escape(message.subject)
@ -144,7 +144,7 @@ end
function mail.reply(name, message)
mail.ensure_new_format(message)
local replyfooter = "Type your reply here.\n\n--Original message follows--\n" ..message.body
mail.show_compose(name, message.from, "Re: "..message.subject, replyfooter)
mail.show_compose(name, message.sender, "Re: "..message.subject, replyfooter)
end
function mail.replyall(name, message)
@ -152,8 +152,8 @@ function mail.replyall(name, message)
local replyfooter = "Type your reply here.\n\n--Original message follows--\n" ..message.body
-- new recipients are the sender plus the original recipients, minus ourselves
local recipients = message.to
if message.from ~= nil then
recipients = message.from .. ", " .. recipients
if message.sender ~= nil then
recipients = message.sender .. ", " .. recipients
end
recipients = mail.parse_player_list(recipients)
for k,v in pairs(recipients) do

Binary file not shown.

View File

@ -50,7 +50,6 @@ end
function mail.ensure_new_format(message)
if message.sender then
message.from = message.sender
message.to = name
end
end