From 9422add41561835f281e5e3cbb3ac45ceee99490 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 2 Feb 2018 21:00:09 +0000 Subject: [PATCH] Add support for the email mod --- .luacheckrc | 1 + depends.txt | 1 + init.lua | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.luacheckrc b/.luacheckrc index 3c8acff..d636362 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -11,5 +11,6 @@ read_globals = { "intllib", "default", "rules", + "email", table = { fields = { "copy", "getn" } } } diff --git a/depends.txt b/depends.txt index 5f590f8..6f0ae6b 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ rules? +email? diff --git a/init.lua b/init.lua index a9e9085..54ed1a1 100644 --- a/init.lua +++ b/init.lua @@ -135,7 +135,13 @@ function filter.on_violation(name, message) end end - minetest.log("action", "VIOLATION (" .. resolution .. "): <" .. name .. "> ".. message) + local logmsg = "VIOLATION (" .. resolution .. "): <" .. name .. "> ".. message + minetest.log("action", logmsg) + + local email_to = minetest.settings:get("filter.email_to") + if email_to and minetest.global_exists("email") then + email.send_mail(name, email_to, logmsg) + end end table.insert(minetest.registered_on_chat_messages, 1, function(name, message)