Update irc and irc_commands

This commit is contained in:
Elkien3 2018-02-05 18:17:43 -06:00
parent 2ca8157f69
commit 33bfba9cec
5 changed files with 13 additions and 14 deletions

2
mods/irc/.gitignore vendored
View File

@ -1,2 +0,0 @@
*~

View File

@ -1,3 +0,0 @@
[submodule "src/LuaIRC"]
path = irc
url = https://github.com/ShadowNinja/LuaIRC.git

View File

@ -125,7 +125,7 @@ irc.register_bot_command("list", {
end
})
--[[
irc.register_bot_command("whereis", {
params = "<player>",
description = "Tell the location of <player>",
@ -141,7 +141,7 @@ irc.register_bot_command("whereis", {
local pos = player:getpos()
return true, fmt:format(args, pos.x, pos.y, pos.z)
end
})--]]
})
local starttime = os.time()

View File

@ -1 +0,0 @@
*~

View File

@ -44,22 +44,27 @@ irc:register_bot_command("login", {
return false, "Player name and password required."
end
local inChannel = false
local users = irc.conn.channels[irc.config.channel].users
for cnick, cuser in pairs(users) do
local channel = irc.conn.channels[irc.config.channel]
if not channel then
return false, "The server needs to be in its "..
"channel for anyone to log in."
end
for cnick, cuser in pairs(channel.users) do
if user.nick == cnick then
inChannel = true
break
end
end
if not inChannel then
return false, "You need to be in the server's channel to login."
return false, "You need to be in the server's channel to log in."
end
if minetest.auth_table[playerName] and
minetest.auth_table[playerName].password ==
minetest.get_password_hash(playerName, password) then
local handler = minetest.get_auth_handler()
local auth = handler.get_auth(playerName)
if auth and minetest.check_password_entry(playerName, auth.password, password) then
minetest.log("action", "User "..user.nick
.." from IRC logs in as "..playerName)
irc_users[user.nick] = playerName
handler.record_login(playerName)
return true, "You are now logged in as "..playerName
else
minetest.log("action", user.nick.."@IRC attempted to log in as "