Remove chatplus
This commit is contained in:
parent
1e65b00545
commit
949aa35afc
8 changed files with 1 additions and 617 deletions
22
mods/chatplus/.gitattributes
vendored
22
mods/chatplus/.gitattributes
vendored
|
@ -1,22 +0,0 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
215
mods/chatplus/.gitignore
vendored
215
mods/chatplus/.gitignore
vendored
|
@ -1,215 +0,0 @@
|
|||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
|
@ -1,18 +0,0 @@
|
|||
# Chatplus
|
||||
|
||||
**NOTE: Chatplus has split into two mods, chatplus and [email](https://github.com/rubenwardy/email)**
|
||||
|
||||
Adds ignoring, distance limiting (optional) and a swear filter (optional). Also provides a powerful API.
|
||||
|
||||
License: GPL 3.0 or later.
|
||||
|
||||
Created by rubenwardy.
|
||||
|
||||
## Chat commands
|
||||
|
||||
* /ignore [name] - ignore a player
|
||||
* /unignore [name] - unignore a player
|
||||
|
||||
## HUD
|
||||
|
||||
This mod adds a new message icon to the HUD. If HUDs are not supported, no icon is added.
|
|
@ -1,254 +0,0 @@
|
|||
-- Chat Plus
|
||||
-- by rubenwardy
|
||||
---------------------
|
||||
-- api.lua
|
||||
-- Core functionality
|
||||
---------------------
|
||||
|
||||
|
||||
chatplus = {
|
||||
version = 2.3,
|
||||
_logpath = minetest.get_worldpath().."/chatplus-log.txt",
|
||||
_defsettings = {
|
||||
log = true,
|
||||
use_gui = true,
|
||||
distance = 0,
|
||||
badwords = ""
|
||||
}
|
||||
}
|
||||
|
||||
function chatplus.init()
|
||||
chatplus.load()
|
||||
chatplus.clean_players()
|
||||
|
||||
if not chatplus.players then
|
||||
chatplus.players = {}
|
||||
end
|
||||
chatplus.count = 0
|
||||
chatplus.loggedin = {}
|
||||
chatplus._handlers = {}
|
||||
end
|
||||
|
||||
function chatplus.setting(name)
|
||||
local get = minetest.settings:get("chatplus_" .. name)
|
||||
if get then
|
||||
return get
|
||||
elseif chatplus._defsettings[name]~= nil then
|
||||
return chatplus._defsettings[name]
|
||||
else
|
||||
minetest.log("[Chatplus] Setting chatplus_" .. name .. " not found!")
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.log(msg)
|
||||
if chatplus._log then
|
||||
chatplus._log:write(os.date("%Y-%m-%d %H:%M:%S") .. " " .. msg .. "\r\n")
|
||||
chatplus._log:flush()
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.load()
|
||||
-- Initialize the log
|
||||
if chatplus.setting("log") then
|
||||
chatplus._log = io.open(chatplus._logpath, "a+")
|
||||
if not chatplus._log then
|
||||
minetest.log("error", "Unable to open the chatplus log file: " .. chatplus._logpath)
|
||||
else
|
||||
minetest.log("action", "Logging chat plus to: " .. chatplus._logpath)
|
||||
end
|
||||
chatplus.log("*** SERVER STARTED ***")
|
||||
end
|
||||
|
||||
-- Load player data
|
||||
minetest.log("[Chatplus] Loading data")
|
||||
local file = io.open(minetest.get_worldpath() .. "/chatplus.txt", "r")
|
||||
if file then
|
||||
local from_file = minetest.deserialize(file:read("*all"))
|
||||
file:close()
|
||||
if type(from_file) == "table" then
|
||||
if from_file.players and from_file.version >= 2 then
|
||||
chatplus.players = from_file.players
|
||||
else
|
||||
chatplus.old_inbox = {}
|
||||
chatplus.players = {}
|
||||
for name, data in pairs(from_file) do
|
||||
local inbox = data.inbox
|
||||
data.inbox = nil
|
||||
chatplus.players[name] = data
|
||||
chatplus.old_inbox[name] = {}
|
||||
for _, msg in pairs(inbox) do
|
||||
table.insert(chatplus.old_inbox[name], {
|
||||
date = "?",
|
||||
from = "?",
|
||||
msg = msg
|
||||
})
|
||||
end
|
||||
end
|
||||
if chatplus.on_old_inbox then
|
||||
chatplus.on_old_inbox(chatplus.old_inbox)
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.save()
|
||||
minetest.log("[Chatplus] Saving data")
|
||||
|
||||
local file = io.open(minetest.get_worldpath().."/chatplus.txt", "w")
|
||||
if file then
|
||||
file:write(minetest.serialize({ version = 2, players = chatplus.players}))
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
local function clean_player(name, value)
|
||||
if value.messages then
|
||||
value.inbox = value.messages
|
||||
value.messages = nil
|
||||
end
|
||||
|
||||
if (
|
||||
(not value.inbox or #value.inbox==0) and
|
||||
(not value.ignore or #value.ignore==0)
|
||||
) then
|
||||
chatplus.players[name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function chatplus.clean_players()
|
||||
if not chatplus.players then
|
||||
chatplus.players = {}
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log("[Chatplus] Cleaning player lists")
|
||||
for key,value in pairs(chatplus.players) do
|
||||
clean_player(key, value)
|
||||
end
|
||||
chatplus.save()
|
||||
end
|
||||
|
||||
local function cp_tick()
|
||||
chatplus.clean_players()
|
||||
minetest.after(30*60, cp_tick)
|
||||
end
|
||||
minetest.after(30*60, cp_tick)
|
||||
|
||||
function chatplus.poke(name,player)
|
||||
local function check(name2, value)
|
||||
if not chatplus.players[name2][value] then
|
||||
chatplus.players[name2][value] = {}
|
||||
end
|
||||
end
|
||||
if not chatplus.players[name] then
|
||||
chatplus.players[name] = {}
|
||||
end
|
||||
check(name, "ignore")
|
||||
check(name, "inbox")
|
||||
|
||||
chatplus.players[name].enabled = true
|
||||
|
||||
if player then
|
||||
if player=="end" then
|
||||
chatplus.players[name].enabled = false
|
||||
chatplus.loggedin[name] = nil
|
||||
clean_player(name, chatplus.players[name])
|
||||
else
|
||||
if not chatplus.loggedin[name] then
|
||||
chatplus.loggedin[name] = {}
|
||||
end
|
||||
chatplus.loggedin[name].player = player
|
||||
end
|
||||
end
|
||||
|
||||
chatplus.save()
|
||||
|
||||
return chatplus.players[name]
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
chatplus.poke(player:get_player_name(), player)
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
chatplus.poke(player:get_player_name(), "end")
|
||||
end)
|
||||
|
||||
function chatplus.register_handler(func,place)
|
||||
if not place then
|
||||
table.insert(chatplus._handlers, func)
|
||||
else
|
||||
table.insert(chatplus._handlers, place, func)
|
||||
end
|
||||
end
|
||||
|
||||
-- Allows overriding
|
||||
function chatplus.log_message(from, msg)
|
||||
chatplus.log("<" .. from .. "> " .. msg)
|
||||
end
|
||||
|
||||
function chatplus.send(from, msg)
|
||||
if msg:sub(1, 1) == "/" then
|
||||
return false
|
||||
end
|
||||
|
||||
if not minetest.check_player_privs(from, {shout = true}) then
|
||||
return nil
|
||||
end
|
||||
|
||||
chatplus.log_message(from, msg)
|
||||
|
||||
if #chatplus._handlers == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Loop through possible receivers
|
||||
for to, value in pairs(chatplus.loggedin) do
|
||||
if to ~= from then
|
||||
-- Run handlers
|
||||
local res = nil
|
||||
for i = 1, #chatplus._handlers do
|
||||
if chatplus._handlers[i] then
|
||||
res = chatplus._handlers[i](from, to, msg)
|
||||
|
||||
if res ~= nil then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Send message
|
||||
if res == nil or res == true then
|
||||
minetest.chat_send_player(to, "<" .. from .. "> " .. msg)
|
||||
end
|
||||
elseif minetest.features.no_chat_message_prediction then
|
||||
chatplus.send_message_to_sender(from, msg)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function chatplus.send_message_to_sender(from, msg)
|
||||
minetest.chat_send_player(from, "<" .. from .. "> " .. msg)
|
||||
end
|
||||
|
||||
|
||||
-- Minetest callbacks
|
||||
minetest.register_on_chat_message(function(...)
|
||||
local ret = chatplus.send(...)
|
||||
if ret and minetest.global_exists("irc") and irc.on_chatmessage then
|
||||
irc.on_chatmessage(...)
|
||||
end
|
||||
return ret
|
||||
end)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
chatplus.log(player:get_player_name() .. " joined")
|
||||
end)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
chatplus.poke(player:get_player_name(), "end")
|
||||
chatplus.log(player:get_player_name() .. " disconnected")
|
||||
end)
|
||||
chatplus.init()
|
|
@ -1,2 +0,0 @@
|
|||
Adds chat functions such as ignoring, distance limiting, and swear filtering.
|
||||
Also provides a powerful API, and optionally allows distance limiting.
|
|
@ -1,105 +0,0 @@
|
|||
-- Chat Plus
|
||||
-- by rubenwardy
|
||||
---------------------
|
||||
-- init.lua
|
||||
-- Three handlers: ignoring, distance, and mail.
|
||||
---------------------
|
||||
|
||||
dofile(minetest.get_modpath("chatplus") .. "/api.lua")
|
||||
|
||||
--
|
||||
-- Ignoring
|
||||
--
|
||||
chatplus.register_handler(function(from, to, msg)
|
||||
if chatplus.players[to] and chatplus.players[to].ignore and chatplus.players[to].ignore[from] then
|
||||
return false
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("ignore", {
|
||||
params = "name",
|
||||
description = "ignore: Ignore a player",
|
||||
func = function(name, param)
|
||||
chatplus.poke(name)
|
||||
if not chatplus.players[name].ignore[param] then
|
||||
chatplus.players[name].ignore[param] = true
|
||||
minetest.chat_send_player(name, param .. " has been ignored")
|
||||
chatplus.save()
|
||||
else
|
||||
minetest.chat_send_player(name, "Player " .. param .. " is already ignored.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("unignore", {
|
||||
params = "name",
|
||||
description = "unignore: Unignore a player",
|
||||
func = function(name, param)
|
||||
chatplus.poke(name)
|
||||
if chatplus.players[name].ignore[param] then
|
||||
chatplus.players[name].ignore[param] = false
|
||||
minetest.chat_send_player(name, param .. " has been unignored")
|
||||
chatplus.save()
|
||||
else
|
||||
minetest.chat_send_player(name, "Player " .. param .. " is already unignored.")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Distance
|
||||
--
|
||||
chatplus.register_handler(function(from, to, msg)
|
||||
local d = chatplus.setting("distance")
|
||||
if d <= 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local from_o = minetest.get_player_by_name(from)
|
||||
local to_o = minetest.get_player_by_name(to)
|
||||
if not from_o or not to_o then
|
||||
return nil
|
||||
end
|
||||
|
||||
return not d or vector.distance(from_o:getpos(), to_o:getpos()) <= tonumber(d)
|
||||
end)
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Bad words
|
||||
--
|
||||
chatplus.register_handler(function(from,to,msg)
|
||||
local words = chatplus.setting("badwords"):split(",")
|
||||
for _,v in pairs(words) do
|
||||
if (v:trim()~="") and ( msg:find(v:trim(), 1, true) ~= nil ) then
|
||||
minetest.chat_send_player(from, "Swearing is banned")
|
||||
return false
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end)
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Highlighted PMs
|
||||
--
|
||||
minetest.registered_chatcommands["msg"].func = function(name, param)
|
||||
local sendto, message = param:match("^(%S+)%s(.+)$")
|
||||
if not sendto then
|
||||
return false, "Invalid usage, see /help msg."
|
||||
end
|
||||
if not minetest.get_player_by_name(sendto) then
|
||||
return false, "The player " .. sendto
|
||||
.. " is not online."
|
||||
end
|
||||
minetest.log("action", "PM from " .. name .. " to " .. sendto
|
||||
.. ": " .. message)
|
||||
minetest.chat_send_player(sendto, minetest.colorize("#00FF55",
|
||||
"PM from " .. name .. ": " .. message))
|
||||
return true, "Message sent."
|
||||
end
|
Binary file not shown.
Before Width: | Height: | Size: 270 B |
|
@ -8,5 +8,5 @@ Suppose `player`, `griefer` and `moderator` are online players.
|
|||
The Admin (named in "name") is mailed via chatplus: `<player1> Report: player2 is griefing (mods online: player3)`
|
||||
|
||||
License: WTFPL
|
||||
Depends: chatplus.
|
||||
Depends: email.
|
||||
|
||||
|
|
Loading…
Reference in a new issue