From 4aa89fc5a0f14eb8ea375590732ac3a91ce376a4 Mon Sep 17 00:00:00 2001 From: equa Date: Wed, 8 Mar 2023 11:27:40 -0500 Subject: fix up illegal char handling. oops --- TODO | 19 +++++++++++++++++-- bot.lua | 2 +- config.example.lua | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 9272c79..fb06ac4 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,27 @@ support joining irc channels with keys throttle really long streams of messages -- barring real absurd cases i think the best way to do this would + barring real absurd cases i think the best way to do this would be to cut off any more than N (say ten) messages sent to a channel within any timespan (say, a second) commands with a lot of output (1000 lines, say) will probably be processed by the queue fast enough to just get rid of them this isn't the best possible system but it will work reasonable interop between unicode and non-unicode -- we can just send bytes as-is, but i think this is unwise. we can + we can just send bytes as-is, but i think this is unwise. we can *accept* bytes as is, which is fine i think, and then make non- unicode bytes turn into their unicode counterparts +implement alternative authentications + right now we can do pass in ergo with PASS + but i'd love to be able to do SASL or nickserv too + maybe a better generalized solution would be sending arbitrary commands on entry + i'd also love client-side cert auth but i don't think luaossl knows how to do this +be smarter about SSL verification + enable it by default but include an option +allow running non-interactively + we have a clunky stdin-to-irc-command interface + and it exclusively causes problems for us + we can poll on it in interactive contexts but this causes a failure + when we try to poll from a regular file, killing edward altogether + also, the stdin interface is generally messy and should be configurable +handle basic failures cleanly + we should have actual error messages when we fail to connect to servers etc diff --git a/bot.lua b/bot.lua index 66e3d12..55ce64f 100644 --- a/bot.lua +++ b/bot.lua @@ -48,7 +48,7 @@ local function emit_message(message) table.insert(out, message.command) for i, v in ipairs(message.params or {}) do - assert(not string.match(i, "[\0\r\n]")) + v = string.gsub(v, "[\0\r\n]", "") if i == #(message.params or {}) then table.insert(out, " :") diff --git a/config.example.lua b/config.example.lua index faafcf4..3a1181e 100644 --- a/config.example.lua +++ b/config.example.lua @@ -8,7 +8,7 @@ return { debug = true, nick = "edward", user = "edward", - -- pass = "user:pass" + -- pass = "user:pass", -- allow dms? currently unimplemented direct = false, -- directory to run commands under. this can also be specified -- cgit 1.3.0-6-gf8a5