summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2016-04-25 02:54:35 -0500
committercheapie <no-email-for-you@example.com>2016-04-25 02:54:35 -0500
commit9fccbb3e8d5a2877b5f3891424193cd36386204c (patch)
tree3a9c0d10cb127093c38fb086801e98eea168e5ae /init.lua
parent6f190464fd1dc3d439958003622d6341ebf51d72 (diff)
downloadmail-9fccbb3e8d5a2877b5f3891424193cd36386204c.tar
mail-9fccbb3e8d5a2877b5f3891424193cd36386204c.tar.gz
mail-9fccbb3e8d5a2877b5f3891424193cd36386204c.tar.bz2
mail-9fccbb3e8d5a2877b5f3891424193cd36386204c.tar.xz
mail-9fccbb3e8d5a2877b5f3891424193cd36386204c.zip
Add about screen
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 3a7c918..dd692fe 100644
--- a/init.lua
+++ b/init.lua
@@ -30,6 +30,7 @@ mail.inboxformspec = "size[8,9;]"..
"button[6.25,3;1.5,0.5;delete;Delete]"..
"button[6.25,4;1.5,0.5;markread;Mark Read]"..
"button[6.25,5;1.5,0.5;markunread;Mark Unread]"..
+ "button[6.25,8;1.5,0.5;about;About]"..
"textlist[0,0.5;6,8.5;message;"
function mail.send(src,dst,subject,body)
@@ -45,6 +46,20 @@ function mail.send(src,dst,subject,body)
mail.save()
end
+function mail.showabout(name)
+ local formspec = "size[4,5;]"..
+ "button[3,0;1,1;back;Back]"..
+ "label[0,0;Mail]"..
+ "label[0,0.5;By cheapie]"..
+ "label[0,1;http://github.com/cheapie/mail]"..
+ "label[0,1.5;See LICENSE file for license information]"..
+ "label[0,2.5;NOTE: Communication using this system]"..
+ "label[0,3;is NOT guaranteed to be private!]"..
+ "label[0,3.5;Admins are able to view the messages]"..
+ "label[0,4;of any player.]"
+ minetest.show_formspec(name,"mail:about",formspec)
+end
+
function mail.showinbox(name)
local formspec = mail.inboxformspec
if not mail.messages[name] then mail.messages[name] = {} end
@@ -90,7 +105,9 @@ function mail.showcompose(name,defaulttgt,defaultsubj,defaultbody)
end
minetest.register_on_player_receive_fields(function(player,formname,fields)
- if formname == "mail:inbox" then
+ if formname == "mail:about" then
+ mail.showinbox(player:get_player_name())
+ elseif formname == "mail:inbox" then
local name = player:get_player_name()
if fields.message then
local event = minetest.explode_textlist_event(fields.message)
@@ -123,6 +140,8 @@ minetest.register_on_player_receive_fields(function(player,formname,fields)
if minetest.get_modpath("unified_inventory") then
unified_inventory.set_inventory_formspec(player, "craft")
end
+ elseif fields.about then
+ mail.showabout(name)
end
return true
elseif formname == "mail:message" then