From 33bfba9cec0784392428c06e88772c281f25a62b Mon Sep 17 00:00:00 2001 From: Elkien3 Date: Mon, 5 Feb 2018 18:17:43 -0600 Subject: [PATCH] Update irc and irc_commands --- mods/irc/.gitignore | 2 -- mods/irc/.gitmodules | 3 --- mods/irc/botcmds.lua | 4 ++-- mods/irc_commands/.gitignore | 1 - mods/irc_commands/init.lua | 17 +++++++++++------ 5 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 mods/irc/.gitignore delete mode 100644 mods/irc/.gitmodules delete mode 100644 mods/irc_commands/.gitignore diff --git a/mods/irc/.gitignore b/mods/irc/.gitignore deleted file mode 100644 index 5236e1e..0000000 --- a/mods/irc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ - diff --git a/mods/irc/.gitmodules b/mods/irc/.gitmodules deleted file mode 100644 index e56fee3..0000000 --- a/mods/irc/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/LuaIRC"] - path = irc - url = https://github.com/ShadowNinja/LuaIRC.git diff --git a/mods/irc/botcmds.lua b/mods/irc/botcmds.lua index 5c6020a..ba0d025 100644 --- a/mods/irc/botcmds.lua +++ b/mods/irc/botcmds.lua @@ -125,7 +125,7 @@ irc.register_bot_command("list", { end }) ---[[ + irc.register_bot_command("whereis", { params = "", description = "Tell the location of ", @@ -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() diff --git a/mods/irc_commands/.gitignore b/mods/irc_commands/.gitignore deleted file mode 100644 index b25c15b..0000000 --- a/mods/irc_commands/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*~ diff --git a/mods/irc_commands/init.lua b/mods/irc_commands/init.lua index 647b1a4..5aef834 100644 --- a/mods/irc_commands/init.lua +++ b/mods/irc_commands/init.lua @@ -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 "