Unsure if I want to keep this, but, IRC server admin announcements.

This commit is contained in:
Auke Kok 2019-08-07 22:01:47 -07:00
parent 702639ea56
commit 04a76fc0c7
3 changed files with 29 additions and 0 deletions

View File

@ -29,3 +29,27 @@ function announce.all(msg)
end
end
function announce.player(name, msg)
minetest.log("action", "announce to " .. name .. ": " .. msg)
minetest.chat_send_player(name, msg)
if irc and irc.joined_players[name] then
irc.whisper(name, msg)
end
end
function announce.admins(msg)
minetest.log("action", "admin announce: " .. msg)
if not irc then
return
end
local irclist = minetest.settings:get("announce_irc_admins")
if irclist == "" then
return
end
local admins = string.split(string.gsub(irclist, " ", ""), ",")
for _, name in pairs(admins) do
if irc.joined_players[name] then
irc.whisper(name, msg)
end
end
end

View File

@ -160,6 +160,7 @@ function telex.deliver(message)
table.insert(spool, message)
S:set_string("telex_spool", telex.encode(spool))
minetest.log("action", "spooled a message from <" .. message.from .. "> to <" .. message.to .. ">")
announce.admins("spooled a message from <" .. message.from .. "> to <" .. message.to .. ">")
end
end
@ -168,6 +169,7 @@ function telex.retour(message)
if message.from == "MAILER-DEAMON" then
-- discard, we tried hard enough!
minetest.log("action", "discarded an expired spool message from <" .. message.from .. "> to <" .. message.to .. ">")
announce.admins("discarded an expired spool message from <" .. message.from .. "> to <" .. message.to .. ">")
return
end
@ -181,6 +183,7 @@ function telex.retour(message)
table.insert(message.content, 2, "================== ORIGINAL MESSAGE BELOW ================")
telex.deliver(message)
minetest.log("action", "returned a message from <" .. from .. "> back to <" .. to .. ">")
announce.admins("returned a message from <" .. from .. "> back to <" .. to .. ">")
end
-- returns message/mbox

View File

@ -249,4 +249,6 @@ tutorial_entry_lobby = <id> -- tutorial entry lobby box_id
tutorial_exit_lobby = <id> -- tutorial exit lobby box_id
tutorial_exit = (<x>,<y>,<z>) -- where to teleport player at end of tutorial
announce_irc_admins = "john,frank" -- no spaces, lists irc names that will receive admin announcements
```