From d809c8de6a1ada8af04f78e57b1351a9707b30aa Mon Sep 17 00:00:00 2001 From: opi Date: Thu, 27 Nov 2014 13:56:34 +0100 Subject: [PATCH 1/3] [fix] Do not limit amount of mail aliases & forward. --- access.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/access.lua b/access.lua index 7dbd69b..5b46660 100644 --- a/access.lua +++ b/access.lua @@ -299,15 +299,24 @@ end function get_mails(user) local mails = { mail = "", mailalias = {}, maildrop = {} } + -- default mail + mails["mail"] = cache:get(user.."-mail") + + -- mail aliases if cache:get(user.."-mail|2") then - for _, v in ipairs({2, 3, 4, 5, 6, 7, 8, 9, 10}) do - table.insert(mails["mailalias"], cache:get(user.."-mail|"..v)) + local i = 2 + while cache:get(user.."-mail|"..i) do + table.insert(mails["mailalias"], cache:get(user.."-mail|"..i)) + i = i + 1 end end - mails["mail"] = cache:get(user.."-mail") + + -- mail forward if cache:get(user.."-maildrop|2") then - for _, v in ipairs({2, 3, 4, 5, 6, 7, 8, 9, 10}) do - table.insert(mails["maildrop"], cache:get(user.."-maildrop|"..v)) + local i = 2 + while cache:get(user.."-maildrop|"..i) do + table.insert(mails["maildrop"], cache:get(user.."-maildrop|"..i)) + i = i + 1 end end return mails From 696f09c8c2f1ba1432932fc9620de2aa2d55c47a Mon Sep 17 00:00:00 2001 From: opi Date: Thu, 27 Nov 2014 14:19:52 +0100 Subject: [PATCH 2/3] [fix] Clean cache update according to last commit. --- access.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/access.lua b/access.lua index 5b46660..e64c0a9 100644 --- a/access.lua +++ b/access.lua @@ -598,9 +598,14 @@ function do_edit () maildrop = drops }) then cache:delete(user.."-"..conf["ldap_identifier"]) - for _, v in ipairs({2, 3, 4, 5, 6, 7, 8, 9, 10}) do - cache:delete(user.."-maildrop|"..v) - cache:delete(user.."-mail|"..v) + local i = 2 + while cache:get(user.."-mail|"..i) do + cache:delete(user.."-mail|"..i) + i = i + 1 + end + while cache:get(user.."-maildrop|"..i) do + cache:delete(user.."-maildrop|"..i) + i = i + 1 end set_headers(user) -- Ugly trick to reload cache flash("win", t("information_updated")) From b59376814eb5ebfdfa94438245a0c603842e161a Mon Sep 17 00:00:00 2001 From: opi Date: Thu, 27 Nov 2014 14:20:21 +0100 Subject: [PATCH 3/3] [fix] Forget to reset count for maildrop. --- access.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/access.lua b/access.lua index e64c0a9..413b1f3 100644 --- a/access.lua +++ b/access.lua @@ -603,6 +603,7 @@ function do_edit () cache:delete(user.."-mail|"..i) i = i + 1 end + local i = 2 while cache:get(user.."-maildrop|"..i) do cache:delete(user.."-maildrop|"..i) i = i + 1