slack.lua: more unfucking

And now it's already fairly usable.
This commit is contained in:
Přemysl Eric Janouch 2017-05-17 00:32:54 +02:00
parent 96864517c6
commit bdc6334aec
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 25 additions and 0 deletions

View File

@ -48,6 +48,31 @@ degesch.hook_irc (function (hook, server, line)
.. msg.prefix:match "^[^!@]*" .. " :" .. text .. msg.prefix:match "^[^!@]*" .. " :" .. text
end) end)
-- Unfuck :nick!nick@irc.tinyspeck.com MODE #channel +v nick : active
degesch.hook_irc (function (hook, server, line)
if not servers[server.name] then return line end
return line:gsub ("^(:%S+ MODE .+) : .*", "%1")
end)
-- The gateway simply ignores the NAMES command altogether
degesch.hook_input (function (hook, buffer, input)
if not buffer.channel or not servers[buffer.server.name]
or not input:match "^/names%s*" then return input end
local users = buffer.channel.users
table.sort (users, function (a, b)
if a.prefixes > b.prefixes then return true end
if a.prefixes < b.prefixes then return false end
return a.user.nickname < b.user.nickname
end)
local names = "Users on " .. buffer.channel.name .. ":"
for i, chan_user in ipairs (users) do
names = names .. " " .. chan_user.prefixes .. chan_user.user.nickname
end
buffer:log (names)
end)
degesch.hook_completion (function (hook, data, word) degesch.hook_completion (function (hook, data, word)
local chan = degesch.current_buffer.channel local chan = degesch.current_buffer.channel
local server = degesch.current_buffer.server local server = degesch.current_buffer.server