diff --git a/ui/drafts.lua b/ui/drafts.lua index 2fd15f4..a7da0a0 100644 --- a/ui/drafts.lua +++ b/ui/drafts.lua @@ -8,20 +8,20 @@ function mail.show_drafts(name) trash_tab = "," .. S("Trash") end - local drafts_formspec = "size[8.5,10;]" .. mail.theme .. [[ + local drafts_formspec = "size[8.5,11;]" .. mail.theme .. [[ tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. trash_tab .. [[;3;false;false] button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[] button[6,0.95;2.5,0.5;edit;]] .. S("Edit") .. [[] button[6,1.70;2.5,0.5;delete;]] .. S("Delete") .. [[] - button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[] - button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] - button[6,8.7;2.5,0.5;options;]] .. S("Options") .. [[] - button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[] + button[6,8.0;2.5,0.5;contacts;]] .. S("Contacts") .. [[] + button[6,8.8;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] + button[6,9.7;2.5,0.5;options;]] .. S("Options") .. [[] + button_exit[6,10.5;2.5,0.5;quit;]] .. S("Close") .. [[] tablecolumns[color;text;text] - table[0,0.7;5.75,9.35;drafts;]] .. mail.get_color("header") .. "," .. S("To") .. "," .. S("Subject") + table[0,0.7;5.75,10.35;drafts;]] .. mail.get_color("header") .. "," .. S("To") .. "," .. S("Subject") local formspec = { drafts_formspec } local entry = mail.get_storage_entry(name) diff --git a/ui/events.lua b/ui/events.lua index a5c2e21..4d975e4 100644 --- a/ui/events.lua +++ b/ui/events.lua @@ -313,6 +313,20 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) mail.show_mail_menu(name, sortfieldindex, sortdirection, filter) + elseif fields.markspam then + if formname == "mail:inbox" and mail.selected_idxs.inbox[name] then + mail.mark_spam(name, mail.selected_idxs.inbox[name]) + end + + mail.show_mail_menu(name, sortfieldindex, sortdirection, filter) + + elseif fields.unmarkspam then + if formname == "mail:inbox" and mail.selected_idxs.inbox[name] then + mail.unmark_spam(name, mail.selected_idxs.inbox[name]) + end + + mail.show_mail_menu(name, sortfieldindex, sortdirection, filter) + elseif fields.new then mail.show_compose(name) diff --git a/ui/inbox.lua b/ui/inbox.lua index 660bb54..220d70d 100644 --- a/ui/inbox.lua +++ b/ui/inbox.lua @@ -33,7 +33,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter) trash_tab = "," .. S("Trash") end - local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[ + local inbox_formspec = "size[8.5,11;]" .. mail.theme .. [[ tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. trash_tab .. [[;1;false;false] @@ -43,31 +43,34 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter) button[6,2.45;2.5,0.5;replyall;]] .. S("Reply all") .. [[] button[6,3.20;2.5,0.5;forward;]] .. S("Forward") .. [[] button[6,3.95;2.5,0.5;delete;]] .. S("Delete") .. [[] - button[6,4.82;2.5,0.5;markread;]] .. S("Mark Read") .. [[] + button[6,4.85;2.5,0.5;markread;]] .. S("Mark Read") .. [[] button[6,5.55;2.5,0.5;markunread;]] .. S("Mark Unread") .. [[] - button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[] - button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] - button[6,8.7;2.5,0.5;options;]] .. S("Options") .. [[] - button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[] + button[6,6.4;2.5,0.5;markspam;]] .. S("Mark Spam") .. [[] + button[6,7.1;2.5,0.5;unmarkspam;]] .. S("Unmark Spam") .. [[] + button[6,8.0;2.5,0.5;contacts;]] .. S("Contacts") .. [[] + button[6,8.8;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] + button[6,9.7;2.5,0.5;options;]] .. S("Options") .. [[] + button_exit[6,10.5;2.5,0.5;quit;]] .. S("Close") .. [[] tooltip[reply;]] .. S("Reply only to the sender") .. [[] tooltip[replyall;]] .. S("Reply to all involved people") .. [[] tooltip[forward;]] .. S("Transfer message to other people") .. [[] - dropdown[0,8.5;2,0.5;sortfield;]] .. + dropdown[0,9.5;2,0.5;sortfield;]] .. S("From") .. "," .. S("Subject") .. "," .. S("Date") .. [[;]] .. sortfieldindex .. [[;true] - dropdown[2.0,8.5;2,0.5;sortdirection;]] .. + dropdown[2.0,9.5;2,0.5;sortdirection;]] .. S("Ascending") .. "," .. S("Descending") .. [[;]] .. sortdirection .. [[;true] - field[4.25,8.95;1.4,0.5;filter;]] .. S("Filter") .. [[:;]] .. filter .. [[] - button[5.14,8.62;0.85,0.5;search;Q] + field[4.25,9.95;1.4,0.5;filter;]] .. S("Filter") .. [[:;]] .. filter .. [[] + button[5.14,9.62;0.85,0.5;search;Q] - checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] .. + checkbox[0,10.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] .. tostring(mail.selected_idxs.multipleselection[name]) .. [[] - label[0,9.65;]] .. S("@1 of @2 selected", tostring(#mail.selected_idxs.inbox[name]), tostring(#messages)) .. [[] - button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] + label[0,10.65;]] .. + S("@1 of @2 selected", tostring(#mail.selected_idxs.inbox[name]), tostring(#messages)) .. [[] + button[3.5,10.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] tablecolumns[color;text;text] - table[0,0.7;5.75,7.45;inbox;]] .. mail.get_color("header") .. "," .. S("From") .. "," .. S("Subject") + table[0,0.7;5.75,8.45;inbox;]] .. mail.get_color("header") .. "," .. S("From") .. "," .. S("Subject") local formspec = { inbox_formspec } mail.message_drafts[name] = nil diff --git a/ui/message.lua b/ui/message.lua index f47d617..55c0acf 100644 --- a/ui/message.lua +++ b/ui/message.lua @@ -18,26 +18,31 @@ function mail.show_message(name, id) mail.selected_idxs.message[name] = id local formspec = [[ - size[8,9] + size[10,10] box[0,0;7,1.9;]] .. mail.get_color("highlighted") .. [[] - button[7.25,0.15;0.75,0.5;back;X] + button[9.25,0.15;0.75,0.5;back;X] + button[7.25,-0.07;2,1;receivers;]] .. S("Receivers") .. [[] label[0.2,0.1;]] .. S("From") .. [[: %s] label[0.2,0.5;]] .. S("To") .. [[: %s] label[0.2,0.9;]] .. S("CC") .. [[: %s] label[0.2,1.3;]] .. S("Date") .. [[: %s] tooltip[0.2,1.3;4.8,0.4;]] .. mail.time_ago(message.time) .. [[] - button[5.1,1;2,1;receivers;]] .. S("Receivers") .. [[] label[0,2.1;]] .. S("Subject") .. [[: %s] textarea[0.25,2.6;8,7.0;;;%s] - button[0,8.5;2,1;reply;]] .. S("Reply") .. [[] - button[2,8.5;2,1;replyall;]] .. S("Reply all") .. [[] - button[4,8.5;2,1;forward;]] .. S("Forward") .. [[] - button[6,8.5;2,1;delete;]] .. S("Delete") .. [[] + button[7.25,1.0;2.75,1;reply;]] .. S("Reply") .. [[] + button[7.25,1.8;2.75,1;replyall;]] .. S("Reply all") .. [[] + button[7.25,2.6;2.75,1;forward;]] .. S("Forward") .. [[] + button[7.25,3.6;2.75,1;markspam;]] .. S("Mark Spam") .. [[] + button[7.25,4.4;2.75,1;unmarkspam;]] .. S("Unmark Spam") .. [[] + + box[7.25,5.4;2.5,4.0;]] .. mail.get_color("disabled") .. [[] + + button[7.25,9.5;2.75,1;delete;]] .. S("Delete") .. [[] tooltip[reply;]] .. S("Reply only to the sender") .. [[] tooltip[replyall;]] .. S("Reply to all involved people") .. [[] @@ -134,6 +139,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) elseif fields.forward then mail.forward(name, message) + elseif fields.markspam then + mail.mark_spam(name, message.id) + + elseif fields.unmarkspam then + mail.unmark_spam(name, message.id) + elseif fields.delete then if mail.get_setting(name, "trash_move_enable") and mail.selected_idxs.boxtab[name] ~= 4 then mail.trash_mail(name, message.id) diff --git a/ui/outbox.lua b/ui/outbox.lua index a52c9cb..d403e54 100644 --- a/ui/outbox.lua +++ b/ui/outbox.lua @@ -33,7 +33,7 @@ function mail.show_outbox(name, sortfieldindex, sortdirection, filter) trash_tab = "," .. S("Trash") end - local outbox_formspec = "size[8.5,10;]" .. mail.theme .. [[ + local outbox_formspec = "size[8.5,11;]" .. mail.theme .. [[ tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. trash_tab .. [[;2;false;false] @@ -43,29 +43,30 @@ function mail.show_outbox(name, sortfieldindex, sortdirection, filter) button[6,2.45;2.5,0.5;replyall;]] .. S("Reply all") .. [[] button[6,3.20;2.5,0.5;forward;]] .. S("Forward") .. [[] button[6,3.95;2.5,0.5;delete;]] .. S("Delete") .. [[] - button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[] - button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] - button[6,8.7;2.5,0.5;options;]] .. S("Options") .. [[] - button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[] + button[6,8.0;2.5,0.5;contacts;]] .. S("Contacts") .. [[] + button[6,8.8;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] + button[6,9.7;2.5,0.5;options;]] .. S("Options") .. [[] + button_exit[6,10.5;2.5,0.5;quit;]] .. S("Close") .. [[] tooltip[reply;]] .. S("Reply only to the sender") .. [[] tooltip[replyall;]] .. S("Reply to all involved people") .. [[] tooltip[forward;]] .. S("Transfer message to other people") .. [[] - dropdown[0,8.5;2,0.5;sortfield;]] .. + dropdown[0,9.5;2,0.5;sortfield;]] .. S("To") .. "," .. S("Subject") .. "," .. S("Date") .. [[;]] .. sortfieldindex .. [[;true] - dropdown[2.0,8.5;2,0.5;sortdirection;]] .. + dropdown[2.0,9.5;2,0.5;sortdirection;]] .. S("Ascending") .. "," .. S("Descending") .. [[;]] .. sortdirection .. [[;true] - field[4.25,8.95;1.4,0.5;filter;]] .. S("Filter") .. [[:;]] .. filter .. [[] - button[5.14,8.62;0.85,0.5;search;Q] + field[4.25,9.95;1.4,0.5;filter;]] .. S("Filter") .. [[:;]] .. filter .. [[] + button[5.14,9.62;0.85,0.5;search;Q] - checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] .. + checkbox[0,10.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] .. tostring(mail.selected_idxs.multipleselection[name]) .. [[] - label[0,9.65;]] .. S("@1 of @2 selected", tostring(#mail.selected_idxs.outbox[name]), tostring(#messages)) ..[[] - button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] + label[0,10.65;]] .. + S("@1 of @2 selected", tostring(#mail.selected_idxs.outbox[name]), tostring(#messages)) .. [[] + button[3.5,10.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[] tablecolumns[color;text;text] - table[0,0.7;5.75,7.45;outbox;]] .. mail.get_color("header") .. "," .. S("To") .. "," .. S("Subject") + table[0,0.7;5.75,8.45;outbox;]] .. mail.get_color("header") .. "," .. S("To") .. "," .. S("Subject") local formspec = { outbox_formspec } mail.message_drafts[name] = nil diff --git a/ui/trash.lua b/ui/trash.lua index ef7801e..e90f0ea 100644 --- a/ui/trash.lua +++ b/ui/trash.lua @@ -1,7 +1,7 @@ -- translation local S = minetest.get_translator("mail") -local trash_formspec = "size[8.5,10;]" .. mail.theme .. [[ +local trash_formspec = "size[8.5,11;]" .. mail.theme .. [[ tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. "," .. S("Trash") .. [[;4;false;false] @@ -10,13 +10,13 @@ local trash_formspec = "size[8.5,10;]" .. mail.theme .. [[ button[6,1.70;2.5,0.5;restore;]] .. S("Restore") .. [[] button[6,2.45;2.5,0.5;delete;]] .. S("Delete") .. [[] button[6,3.20;2.5,0.5;empty;]] .. S("Empty") .. [[] - button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[] - button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] - button[6,8.7;2.5,0.5;options;]] .. S("Options") .. [[] - button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[] + button[6,8.0;2.5,0.5;contacts;]] .. S("Contacts") .. [[] + button[6,8.8;2.5,0.5;maillists;]] .. S("Mail lists") .. [[] + button[6,9.7;2.5,0.5;options;]] .. S("Options") .. [[] + button_exit[6,10.5;2.5,0.5;quit;]] .. S("Close") .. [[] tablecolumns[color;text;text] - table[0,0.7;5.75,9.35;trash;]] .. mail.get_color("header") .. "," .. S("From/To") .. "," .. S("Subject") + table[0,0.7;5.75,10.35;trash;]] .. mail.get_color("header") .. "," .. S("From/To") .. "," .. S("Subject") function mail.show_trash(name) diff --git a/util/colors.lua b/util/colors.lua index 3f3d695..cd88ad7 100644 --- a/util/colors.lua +++ b/util/colors.lua @@ -6,6 +6,7 @@ local generic_colors = { highlighted = "#608631", new = "#00F529", warning = "#FF8800", + disabled = "#332222", } local function get_base_color(c)