Add support for the email mod

This commit is contained in:
rubenwardy 2018-02-02 21:00:09 +00:00 committed by sofar
parent a240c39a64
commit 9422add415
3 changed files with 9 additions and 1 deletions

View File

@ -11,5 +11,6 @@ read_globals = {
"intllib",
"default",
"rules",
"email",
table = { fields = { "copy", "getn" } }
}

View File

@ -1 +1,2 @@
rules?
email?

View File

@ -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)