From 4cd06c5f5fe404d11eea39e7c49dcdeff13b95dd Mon Sep 17 00:00:00 2001 From: 1F616EMO Date: Tue, 6 Aug 2024 08:09:00 +0800 Subject: [PATCH] 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. --- ui/inbox.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/inbox.lua b/ui/inbox.lua index 6f50326..019bb0f 100644 --- a/ui/inbox.lua +++ b/ui/inbox.lua @@ -77,6 +77,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter) local unread_color_enable = mail.get_setting(name, "unreadcolorenable") local cc_color_enable = mail.get_setting(name, "cccolorenable") + local mute_list = mail.get_setting(name, "mute_list") if #messages > 0 then for _, message in ipairs(messages) do @@ -103,7 +104,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter) if message.spam then table.insert(displayed_color, "warning") 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") end formspec[#formspec + 1] = "," .. mail.get_color(displayed_color)