mirror of
https://github.com/mt-mods/mail.git
synced 2025-03-15 06:01:25 +00:00
Optimize performance of the inbox
Moves the `mail.get_setting(name, "mute_list")` call out of the message loop. Previously, this is called repeated, causing disastrous lag when using mail with beerchat.
This commit is contained in:
parent
036d37695a
commit
4cd06c5f5f
1 changed files with 2 additions and 1 deletions
|
@ -77,6 +77,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
||||||
|
|
||||||
local unread_color_enable = mail.get_setting(name, "unreadcolorenable")
|
local unread_color_enable = mail.get_setting(name, "unreadcolorenable")
|
||||||
local cc_color_enable = mail.get_setting(name, "cccolorenable")
|
local cc_color_enable = mail.get_setting(name, "cccolorenable")
|
||||||
|
local mute_list = mail.get_setting(name, "mute_list")
|
||||||
|
|
||||||
if #messages > 0 then
|
if #messages > 0 then
|
||||||
for _, message in ipairs(messages) do
|
for _, message in ipairs(messages) do
|
||||||
|
@ -103,7 +104,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
||||||
if message.spam then
|
if message.spam then
|
||||||
table.insert(displayed_color, "warning")
|
table.insert(displayed_color, "warning")
|
||||||
end
|
end
|
||||||
if table.indexof(mail.get_setting(name, "mute_list"), message.from) >= 1 then
|
if table.indexof(mute_list, message.from) >= 1 then
|
||||||
table.insert(displayed_color, "muted")
|
table.insert(displayed_color, "muted")
|
||||||
end
|
end
|
||||||
formspec[#formspec + 1] = "," .. mail.get_color(displayed_color)
|
formspec[#formspec + 1] = "," .. mail.get_color(displayed_color)
|
||||||
|
|
Loading…
Add table
Reference in a new issue