aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-17 00:32:54 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-17 00:32:54 +0200
commitbdc6334aec32a31ed41fc44bff09a0462cd48046 (patch)
treefbcc9f7d1275d2bd5a86c5de60c6f75ffbce4456 /plugins
parent96864517c6304c8af3dbf44e8f4f69bb377274f8 (diff)
downloadxK-bdc6334aec32a31ed41fc44bff09a0462cd48046.tar.gz
xK-bdc6334aec32a31ed41fc44bff09a0462cd48046.tar.xz
xK-bdc6334aec32a31ed41fc44bff09a0462cd48046.zip
slack.lua: more unfucking
And now it's already fairly usable.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/degesch/slack.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/degesch/slack.lua b/plugins/degesch/slack.lua
index 79f5d88..89f0adf 100644
--- a/plugins/degesch/slack.lua
+++ b/plugins/degesch/slack.lua
@@ -48,6 +48,31 @@ degesch.hook_irc (function (hook, server, line)
.. msg.prefix:match "^[^!@]*" .. " :" .. text
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)
local chan = degesch.current_buffer.channel
local server = degesch.current_buffer.server