degesch: improve ad-hoc IRC parsers in plugins

This commit is contained in:
Přemysl Eric Janouch 2020-10-10 17:57:34 +02:00
parent ee5cac4f21
commit 270d9017e9
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ degesch.setup_config {
local censor = function (line) local censor = function (line)
-- Taking a shortcut to avoid lengthy message reassembly -- Taking a shortcut to avoid lengthy message reassembly
local start, text = line:match ("^(.- PRIVMSG .-:)(.*)$") local start, text = line:match ("^(.- PRIVMSG .- :)(.*)$")
local ctcp, rest = text:match ("^(\x01%g+ )(.*)") local ctcp, rest = text:match ("^(\x01%g+ )(.*)")
text = ctcp and ctcp .. "\x0301,01" .. rest or "\x0301,01" .. text text = ctcp and ctcp .. "\x0301,01" .. rest or "\x0301,01" .. text
return start .. text return start .. text

View File

@ -91,7 +91,7 @@ end)
degesch.hook_irc (function (hook, server, line) degesch.hook_irc (function (hook, server, line)
if not servers[server.name] then return line end if not servers[server.name] then return line end
if unemojify then if unemojify then
local start, text = line:match ("^(.- PRIVMSG .-:)(.*)$") local start, text = line:match ("^(.- PRIVMSG .- :)(.*)$")
if start then return start .. text:gsub (":([a-z_]+):", function (name) if start then return start .. text:gsub (":([a-z_]+):", function (name)
if emoji[name] then return emoji[name] end if emoji[name] then return emoji[name] end
return ":" .. name .. ":" return ":" .. name .. ":"