mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 08:21:44 -04:00
Fix luacheck warnings in gui.lua
This commit is contained in:
parent
8d9c1aa43f
commit
c0c3692c2b
1 changed files with 25 additions and 22 deletions
47
gui.lua
47
gui.lua
|
@ -25,7 +25,7 @@ end
|
||||||
|
|
||||||
mail.inbox_formspec = "size[8,10;]" .. theme .. [[
|
mail.inbox_formspec = "size[8,10;]" .. theme .. [[
|
||||||
tabheader[0.3,1;boxtab;Inbox,Sent messages;1;false;false]
|
tabheader[0.3,1;boxtab;Inbox,Sent messages;1;false;false]
|
||||||
|
|
||||||
button[6,0.10;2,0.5;new;New]
|
button[6,0.10;2,0.5;new;New]
|
||||||
button[6,0.95;2,0.5;read;Read]
|
button[6,0.95;2,0.5;read;Read]
|
||||||
button[6,1.70;2,0.5;reply;Reply]
|
button[6,1.70;2,0.5;reply;Reply]
|
||||||
|
@ -38,13 +38,13 @@ mail.inbox_formspec = "size[8,10;]" .. theme .. [[
|
||||||
button[6,7.6;2,0.5;maillists;Mail lists]
|
button[6,7.6;2,0.5;maillists;Mail lists]
|
||||||
button[6,8.7;2,0.5;about;About]
|
button[6,8.7;2,0.5;about;About]
|
||||||
button_exit[6,9.5;2,0.5;quit;Close]
|
button_exit[6,9.5;2,0.5;quit;Close]
|
||||||
|
|
||||||
tablecolumns[color;text;text]
|
tablecolumns[color;text;text]
|
||||||
table[0,0.7;5.75,9.35;inbox;#999,From,Subject]]
|
table[0,0.7;5.75,9.35;inbox;#999,From,Subject]]
|
||||||
|
|
||||||
mail.sent_formspec = "size[8,10;]" .. theme .. [[
|
mail.sent_formspec = "size[8,10;]" .. theme .. [[
|
||||||
tabheader[0.3,1;boxtab;Inbox,Sent messages;2;false;false]
|
tabheader[0.3,1;boxtab;Inbox,Sent messages;2;false;false]
|
||||||
|
|
||||||
button[6,0.10;2,0.5;new;New]
|
button[6,0.10;2,0.5;new;New]
|
||||||
button[6,0.95;2,0.5;read;Read]
|
button[6,0.95;2,0.5;read;Read]
|
||||||
button[6,1.70;2,0.5;reply;Reply]
|
button[6,1.70;2,0.5;reply;Reply]
|
||||||
|
@ -55,7 +55,7 @@ mail.sent_formspec = "size[8,10;]" .. theme .. [[
|
||||||
button[6,7.6;2,0.5;maillists;Mail lists]
|
button[6,7.6;2,0.5;maillists;Mail lists]
|
||||||
button[6,8.7;2,0.5;about;About]
|
button[6,8.7;2,0.5;about;About]
|
||||||
button_exit[6,9.5;2,0.5;quit;Close]
|
button_exit[6,9.5;2,0.5;quit;Close]
|
||||||
|
|
||||||
tablecolumns[color;text;text]
|
tablecolumns[color;text;text]
|
||||||
table[0,0.7;5.75,9.35;sent;#999,To,Subject]]
|
table[0,0.7;5.75,9.35;sent;#999,To,Subject]]
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ function mail.compile_contact_list(name, selected, playernames)
|
||||||
formspec[#formspec + 1] = "]"
|
formspec[#formspec + 1] = "]"
|
||||||
end
|
end
|
||||||
return table.concat(formspec, "")
|
return table.concat(formspec, "")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function mail.show_message(name, msgnumber)
|
function mail.show_message(name, msgnumber)
|
||||||
|
@ -412,8 +412,8 @@ function mail.show_message(name, msgnumber)
|
||||||
local body = minetest.formspec_escape(message.body) or ""
|
local body = minetest.formspec_escape(message.body) or ""
|
||||||
formspec = string.format(formspec, from, to, cc, date, subject, body)
|
formspec = string.format(formspec, from, to, cc, date, subject, body)
|
||||||
|
|
||||||
message_status = mail.getMessageStatus(name, message.id)
|
local message_status = mail.getMessageStatus(name, message.id)
|
||||||
|
|
||||||
if message_status == "unread" then
|
if message_status == "unread" then
|
||||||
mail.setStatus(name, message.id, "read")
|
mail.setStatus(name, message.id, "read")
|
||||||
end
|
end
|
||||||
|
@ -495,7 +495,7 @@ function mail.forward(name, message)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mail.handle_receivefields(player, formname, fields)
|
function mail.handle_receivefields(player, formname, fields)
|
||||||
|
|
||||||
if formname == "mail:about" then
|
if formname == "mail:about" then
|
||||||
minetest.after(0.5, function()
|
minetest.after(0.5, function()
|
||||||
if boxtab_index == 1 then
|
if boxtab_index == 1 then
|
||||||
|
@ -508,7 +508,7 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
|
|
||||||
elseif formname == "mail:inbox" or formname == "mail:sent" then
|
elseif formname == "mail:inbox" or formname == "mail:sent" then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local messages = mail.getPlayerMessages(name)
|
-- split inbox and sent msgs for different tests
|
||||||
local messagesInbox = mail.getPlayerInboxMessages(name)
|
local messagesInbox = mail.getPlayerInboxMessages(name)
|
||||||
local messagesSent = mail.getPlayerSentMessages(name)
|
local messagesSent = mail.getPlayerSentMessages(name)
|
||||||
|
|
||||||
|
@ -529,11 +529,11 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.boxtab == "1" then
|
if fields.boxtab == "1" then
|
||||||
boxtab_index = 1
|
boxtab_index = 1
|
||||||
mail.show_inbox(name)
|
mail.show_inbox(name)
|
||||||
|
|
||||||
elseif fields.boxtab == "2" then
|
elseif fields.boxtab == "2" then
|
||||||
boxtab_index = 2
|
boxtab_index = 2
|
||||||
mail.show_sent(name)
|
mail.show_sent(name)
|
||||||
|
@ -642,26 +642,29 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
return true -- don't uselessly set messages
|
return true -- don't uselessly set messages
|
||||||
|
|
||||||
elseif fields.reply then
|
elseif fields.reply then
|
||||||
|
local message = ""
|
||||||
if messagesInbox[selected_idxs.inbox[name]] then
|
if messagesInbox[selected_idxs.inbox[name]] then
|
||||||
local message = messagesInbox[selected_idxs.inbox[name]]
|
message = messagesInbox[selected_idxs.inbox[name]]
|
||||||
elseif messagesSent[selected_idxs.sent[name]] then
|
elseif messagesSent[selected_idxs.sent[name]] then
|
||||||
local message = messagesSent[selected_idxs.sent[name]]
|
message = messagesSent[selected_idxs.sent[name]]
|
||||||
end
|
end
|
||||||
mail.reply(name, message)
|
mail.reply(name, message)
|
||||||
|
|
||||||
elseif fields.replyall then
|
elseif fields.replyall then
|
||||||
|
local message = ""
|
||||||
if messagesInbox[selected_idxs.inbox[name]] then
|
if messagesInbox[selected_idxs.inbox[name]] then
|
||||||
local message = messagesInbox[selected_idxs.inbox[name]]
|
message = messagesInbox[selected_idxs.inbox[name]]
|
||||||
elseif messagesSent[selected_idxs.sent[name]] then
|
elseif messagesSent[selected_idxs.sent[name]] then
|
||||||
local message = messagesSent[selected_idxs.sent[name]]
|
message = messagesSent[selected_idxs.sent[name]]
|
||||||
end
|
end
|
||||||
mail.replyall(name, message)
|
mail.replyall(name, message)
|
||||||
|
|
||||||
elseif fields.forward then
|
elseif fields.forward then
|
||||||
|
local message = ""
|
||||||
if messagesInbox[selected_idxs.inbox[name]] then
|
if messagesInbox[selected_idxs.inbox[name]] then
|
||||||
local message = messagesInbox[selected_idxs.inbox[name]]
|
message = messagesInbox[selected_idxs.inbox[name]]
|
||||||
elseif messagesSent[selected_idxs.sent[name]] then
|
elseif messagesSent[selected_idxs.sent[name]] then
|
||||||
local message = messagesSent[selected_idxs.sent[name]]
|
message = messagesSent[selected_idxs.sent[name]]
|
||||||
end
|
end
|
||||||
mail.forward(name, message)
|
mail.forward(name, message)
|
||||||
|
|
||||||
|
@ -701,11 +704,11 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
local contacts = mail.getPlayerContacts(name)
|
local contacts = mail.getPlayerContacts(name)
|
||||||
local recipients = mail.parse_player_list(fields.to)
|
local recipients = mail.parse_player_list(fields.to)
|
||||||
local isNew = true
|
local isNew = true
|
||||||
for r_,recipient in ipairs(recipients) do
|
for _,recipient in ipairs(recipients) do
|
||||||
if recipient:split("@")[1] == "" then -- in case of maillist
|
if recipient:split("@")[1] == "" then -- in case of maillist
|
||||||
isNew = false
|
isNew = false
|
||||||
else
|
else
|
||||||
for c_,contact in ipairs(contacts) do
|
for _,contact in ipairs(contacts) do
|
||||||
if contact.name == recipient then
|
if contact.name == recipient then
|
||||||
isNew = false
|
isNew = false
|
||||||
break
|
break
|
||||||
|
@ -1000,7 +1003,7 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
elseif formname == "mail:editmaillist" then
|
elseif formname == "mail:editmaillist" then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local maillists = mail.getPlayerMaillists(name)
|
local maillists = mail.getPlayerMaillists(name)
|
||||||
|
@ -1023,7 +1026,7 @@ function mail.handle_receivefields(player, formname, fields)
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
elseif fields.mail then
|
elseif fields.mail then
|
||||||
|
|
||||||
if boxtab_index == 1 then
|
if boxtab_index == 1 then
|
||||||
|
|
Loading…
Add table
Reference in a new issue