Update chatlog mod to v1.1...

Release: https://github.com/AntumMT/mod-chatlog/tree/v1.1
This commit is contained in:
Jordan Irwin 2021-05-31 11:43:55 -07:00
parent 4c8b1759be
commit 73e230c16f
12 changed files with 170 additions and 45 deletions

View File

@ -29,7 +29,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* [windmill][] ([WTFPL][lic.windmill]) -- version: [47b029d Git][ver.windmill] *2014-08-21* ([patched][patch.windmill])
* chat/
* [away][] ([GPL][lic.gpl2.0]) -- version: [4c1e5a9 Git][ver.away] *2012-03-09* ([patched][patch.away])
* [chatlog][] ([CC0][lic.cc0]) -- version: [1.0][ver.chatlog] *2017-08-12*
* [chatlog][] ([MIT][lic.chatlog]) -- version: [1.1][ver.chatlog] *2021-05-31*
* commerce/
* [atm][] ([GPL][lic.gpl3.0]) -- version: [1.0.4][ver.atm] *2021-04-21* ([patched][patch.atm])
* [currency][] ([LGPL][lic.lgpl3.0] / [CC BY-SA][lic.ccbysa4.0]) -- version: [2021-01-30][ver.currency]
@ -404,6 +404,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[lic.bridges]: mods/buildings/bridges/README.md
[lic.campfire]: mods/campfire/README.md
[lic.castle]: mods/modpacks/castle/LICENSE
[lic.chatlog]: mods/chat/chatlog/LICENSE.txt
[lic.christmas]: mods/buildings/christmas/LICENSE.txt
[lic.cleaner]: mods/admin/cleaner/LICENSE.txt
[lic.cmer_shark]: mods/mobiles/shark/LICENSE.txt
@ -521,7 +522,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.castle_storage]: https://github.com/minetest-mods/castle_storage/tree/ad5e887
[ver.castle_tapestries]: https://github.com/minetest-mods/castle_tapestries/tree/f5e3ac1
[ver.castle_weapons]: https://github.com/minetest-mods/castle_weapons/tree/d3cf095
[ver.chatlog]: https://github.com/AntumMT/mod-chatlog/tree/v1.0
[ver.chatlog]: https://github.com/AntumMT/mod-chatlog/tree/v1.1
[ver.christmas]: https://github.com/TheZenKitteh/minetest-christmas/tree/d3bd872
[ver.cleaner]: https://github.com/AntumMT/mod-cleaner/releases/tag/v1.1
[ver.cmer]: https://github.com/AntumMT/mod-cmer/releases/tag/v1.1-cmer

View File

@ -45,9 +45,6 @@ hard (priority 2):
- waffles:
- waffles:toaster not working as intended
- tries to replace deprecated node name "homedecor:toaster"
- chatlog:
- allow setting custom timestamp format
- split chat log files by date
- sneeker:
- add sound when hit
- port to cmer API

View File

@ -1717,11 +1717,21 @@ coloredwood_enable_stairsplus = true
# *** chatlog ***
## Whether month is displayed before day in timestamp
# (E.g. 'dd/mm/yyyy' vs. 'mm/dd/yy').
# type: bool
# default: true
#chatlog.monthfirst = true
## Timestamp format (see: https://www.lua.org/pil/22.1.html).
# type: string
# default: %m/%d/%Y %H:%M:%S
#chatlog.format = %m/%d/%Y %H:%M:%S
## Chatlog is output to single file (chatlog.txt) instead
# of split into files by date (chatlog/YYYY_MM_DD.txt).
# type: bool
# default: false
#chatlog.single_file = false
## Disables exporting chat.
# type: bool
# default: false
#chatlog.disable = false
# *** listitems ***

View File

@ -0,0 +1,24 @@
The MIT License (MIT)
Copyright © 2021 Jordan Irwin (AntumDeluge)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original code by JBR (CC0)

View File

@ -1,11 +1,40 @@
# Chatlog by JBR
---
### Description:
Creates a *chatlog.txt* file in the world directory.
License: [CC0][lic.cc0]
[lic.cc0]: LICENSE.txt
## Chat Log for Minetest
---
### Description:
A [Minetest][] mod that logs player conversations to the world directory.
Originally forked from [JBR's chatlog mod](https://forum.minetest.net/viewtopic.php?t=6220).
---
### Usage:
Available configuration settings:
- `chatlog.format`
- String representing timestamp format (see: https://www.lua.org/pil/22.1.html).
- default: `%m/%d/%Y %H:%M:%S`
- `chatlog.single_file`
- Output to a single file (chatlog.txt) instead of separating by date (chatlog/YYYY_MM_DD.txt).
- default: `false`
- `chatlog.disable`
- Disables logging.
- default: `false`
---
### Licensing:
[MIT](LICENSE.txt)
---
### Links:
- [![ContentDB](https://content.minetest.net/packages/AntumDeluge/chatlog/shields/title/)](https://content.minetest.net/packages/AntumDeluge/chatlog/)
- [Forum](https://forum.minetest.net/viewtopic.php?t=18287)
- [Git repo](https://github.com/AntumMT/mod-chatlog)
- [Changelog](changelog.txt)
- [TODO](TODO.txt)
[Minetest]: http://www.minetest.net/

View File

@ -0,0 +1,2 @@
TODO:

View File

@ -0,0 +1,7 @@
v1.1
----
- changed license to MIT
- timestamp format can be customized
- chatlog is split into files by date by default
- added setting to disable logging

View File

@ -1 +0,0 @@
Creates a *chatlog.txt* file in the world directory.

View File

@ -1,17 +1,53 @@
-- License: CC0
local chatlog = minetest.get_worldpath().."/chatlog.txt"
monthfirst = minetest.settings:get_bool('chatlog.monthfirst') or true -- Whether month is displayed before day in timestamp
function playerspeak(name,msg)
local f = io.open(chatlog, "a")
if monthfirst then
f:write(os.date("(%m/%d/%y %X) ["..name.."]: "..msg.."\n"))
else
f:write(os.date("(%d/%m/%y %X) ["..name.."]: "..msg.."\n"))
end
f:close()
end
minetest.register_on_chat_message(playerspeak)
-- License: MIT
chatlog = {}
chatlog.modname = core.get_current_modname()
function chatlog.log(lvl, msg)
if not msg then
msg = lvl
lvl = nil
end
msg = "[" .. chatlog.modname .. "] " .. msg
if not lvl then
core.log(msg)
else
core.log(lvl, msg)
end
end
chatlog.format = core.settings:get("chatlog.format") or "%m/%d/%Y %H:%M:%S"
chatlog.single_file = core.settings:get_bool("chatlog.single_file", false)
chatlog.out = minetest.get_worldpath() .. "/chatlog"
if chatlog.single_file then
chatlog.out = chatlog.out .. ".txt"
end
local function write_log(name, msg)
local out_file = chatlog.out
if not chatlog.single_file then
-- make sure directory exists
if not core.mkdir(chatlog.out) then
chatlog.log("error", "could not create directory for writing: " .. chatlog.out)
return
end
out_file = chatlog.out .. "/" .. os.date("%Y_%m_%d") .. ".txt"
end
local f = io.open(out_file, "a")
if f then
f:write("(" .. os.date(chatlog.format) .. ") [" .. name .. "]: " .. msg .. "\n")
f:close()
else
chatlog.log("error", "could not open chatlog file for writing: " .. out_file)
end
end
if not core.settings:get_bool("chatlog.disable", false) then
core.register_on_chat_message(write_log)
end

View File

@ -1,4 +1,5 @@
name = chatlog
description = Creates a chatlog.txt file in the world directory.
license = MIT
version = 1.1
author = JBR, Jordan Irwin (AntumDeluge)
license = CC0
version = 1.0

View File

@ -1,2 +1,12 @@
# Whether month is displayed before day in timestamp (E.g. 'dd/mm/yyyy' vs. 'mm/dd/yyyy').
chatlog.monthfirst (Timestamp shows month before day) bool true
# Timestamp format (see: https://www.lua.org/pil/22.1.html).
#
# Default: %m/%d/%Y %H:%M:%S (mm/dd/yyyy hh:mm:ss)
chatlog.format (Timestamp format) string %m/%d/%Y %H:%M:%S
# Chatlog is output to single file (chatlog.txt) instead
# of split into files by date (chatlog/YYYY_MM_DD.txt).
chatlog.single_file (Single file chatlog) bool false
# Disables exporting chat.
chatlog.disable (Disable chatlog) bool false

View File

@ -497,8 +497,17 @@ bright_night_light (Night light level) int 4
[*chatlog]
# Whether month is displayed before day in timestamp (E.g. 'dd/mm/yyyy' vs. 'mm/dd/yy').
chatlog.monthfirst (Timestamp shows month before day) bool true
# Timestamp format (see: https://www.lua.org/pil/22.1.html).
#
# Default: %m/%d/%Y %H:%M:%S (mm/dd/yyyy hh:mm:ss)
chatlog.format (Timestamp format) string %m/%d/%Y %H:%M:%S
# Chatlog is output to single file (chatlog.txt) instead
# of split into files by date (chatlog/YYYY_MM_DD.txt).
chatlog.single_file (Single file chatlog) bool false
# Disables exporting chat.
chatlog.disable (Disable chatlog) bool false
[*craftguide]