summaryrefslogtreecommitdiff
path: root/stdin.lua
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-05-03 22:57:53 -0400
committerTest_User <hax@andrewyu.org>2023-05-03 22:57:53 -0400
commite4b5445b3ca844e568a84abbf931a026a6ca6226 (patch)
tree9d9d615406c5a91036ebcd5b23bd8af30d3e8f3d /stdin.lua
parentec8b1682e86535333c34966f6aafee349e609641 (diff)
downloadcoupserv-e4b5445b3ca844e568a84abbf931a026a6ca6226.tar.gz
coupserv-e4b5445b3ca844e568a84abbf931a026a6ca6226.zip
C HaxServ
Diffstat (limited to 'stdin.lua')
-rw-r--r--stdin.lua132
1 files changed, 0 insertions, 132 deletions
diff --git a/stdin.lua b/stdin.lua
deleted file mode 100644
index 4b69590..0000000
--- a/stdin.lua
+++ /dev/null
@@ -1,132 +0,0 @@
---[[
-
-Network protocol file for HaxServ.
-
-Written by: Test_User <hax@andrewyu.org>
-
-This is free and unencumbered software released into the public
-domain.
-
-Anyone is free to copy, modify, publish, use, compile, sell, or
-distribute this software, either in source code form or as a compiled
-binary, for any purpose, commercial or non-commercial, and by any
-means.
-
-In jurisdictions that recognize copyright laws, the author or authors
-of this software dedicate any and all copyright interest in the
-software to the public domain. We make this dedication for the benefit
-of the public at large and to the detriment of our heirs and
-successors. We intend this dedication to be an overt act of
-relinquishment in perpetuity of all present and future rights to this
-software under copyright law.
-
-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 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.
-]]
-
-stdin_commands = {
- [":"] = function(con, msg, args)
- con:send(msg:sub(3).."\n")
- end,
-
- ["RELOAD"] = function(con, msg, args)
- if #args == 0 then
- config_file:seek("set", 0)
- local success, value_or_err = pcall(json.decode, config_file:read("*a"))
- if success then
- config = value_or_err
- print("Successfully reloaded config.json")
- else
- print("Unable to reload config.json")
- print(value_or_err)
- end
-
- for file, _ in pairs(config.files) do
- local success, err = pcall(dofile, path..file)
- if success then
- print("Successfully reloaded "..file)
- else
- print("Unable to reload "..file)
- print(err)
- end
- end
- else
- local file = args[1]..".lua"
- if config.files[file] then
- local success, err = pcall(dofile, path..file)
- if success then
- print("Successfully reloaded "..file)
- else
- print("Unable to reload "..file)
- print(err)
- end
- elseif args[1] == "config" then
- config_file:seek("set", 0)
- local success, value_or_err = pcall(json.decode, config_file:read("*a"))
- if success then
- config = value_or_err
- print("Successfully reloaded config.json")
- else
- print("Unable to reload config.json")
- print(value_or_err)
- end
- else
- print("Invalid section.")
- end
- end
- end,
-
- ["ALLOW"] = function(con, msg, args)
- if #args == 0 then
- print("Not enough args.")
- else
- for id, tbl in pairs(userlist) do
- if tbl.nick == args[1] then
- userlist[id].opertype = "Admin"
- print(args[1].." is now considered an oper.")
- return
- end
- end
- print("Nick not found.")
- end
- end,
-
- ["DENY"] = function(con, msg, args)
- if #args == 0 then
- print("Not enough args.")
- else
- for id, tbl in pairs(userlist) do
- if tbl.nick == args[1] then
- userlist[id].opertype = nil
- con:send(":1HC000000 MODE "..id.." -o\n")
- print(args[1].." is no longer an oper.")
- return
- end
- end
- print("Nick not found.")
- end
- end,
-
- ["ADDSH"] = function(con, msg, args)
- if msg:find(" ") == nil then
- print("Not enough args.")
- else
- local i = msg:find(" ")
- bash_command = msg:sub(i + 1) -- yes, global
- print(bash_command)
- end
- end,
-
- ["SET_CHANNEL"] = function(con, msg, args)
- cur_channel = args[1]
- end,
-
- ["M"] = function(con, msg, args)
- con:send(":1HC000000 PRIVMSG "..cur_channel.." :"..table.concat(args, " ").."\n")
- end,
-}