Skip to content

Instantly share code, notes, and snippets.

@patthoyts
Created October 17, 2020 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patthoyts/978a381597de578ca6c32507f4066119 to your computer and use it in GitHub Desktop.
Save patthoyts/978a381597de578ca6c32507f4066119 to your computer and use it in GitHub Desktop.
Hexchat plugin for #tcl on freenode to fixup the nicks comin from the IRC bridges
-- Script to fixup the nicks posted by the Jabber bridge on
-- the #tcl and #tcltest IRC channels.
--
local name = "tclchat"
local desc = "Fixup messages from the Jabber bridge on #tcl"
local version = "0.2"
hexchat.register(name, version, desc)
-- word is a table containing userid@host PRIVMSG chan nick words ...
-- world_eol is a table of strings, each string starting one word further on.
local function on_privmsg(word, word_eol)
local channel = hexchat.get_info("channel")
if hexchat.nickcmp(channel,"#tcltest") == 0 or hexchar.nickcmp(channel,"#tcl") == 0 then
local ctx = hexchat.get_context()
local nick = string.sub(word[1], 1, 8)
if nick == ":ijtest!" or nick == ":ijchain" or nick == ":ischain" then
local lm,rm = "‹","›"
if nick == ":ischain" then
lm,rm = "«","»"
end
if string.find(word[4], "\001ACTION") then
local name = word[5]
local msg = string.gsub(word_eol[6], "\001", "")
ctx:print("*\t" .. lm .. name .. rm .. " " .. msg)
else
local name = string.sub(word[4], 4, string.len(word[4])-1)
local msg = word_eol[5]
ctx:print(lm .. name .. rm .. "\t" .. msg)
end
return hexchat.EAT_ALL
end
end
return hexchat.EAT_NONE
end
hexchat.hook_server("PRIVMSG", on_privmsg)
hexchat.print("=lua=\ttclchat script loaded.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment