Thu, 20 May 2010 14:36:14 +0100
Rudimentary presence plugin to auto-accept subscription requests
init.lua | file | annotate | diff | comparison | revisions | |
plugins/presence.lua | file | annotate | diff | comparison | revisions | |
squishy | file | annotate | diff | comparison | revisions |
--- a/init.lua Thu May 20 14:34:22 2010 +0100 +++ b/init.lua Thu May 20 14:36:14 2010 +0100 @@ -67,6 +67,10 @@ self:send(st.message({ to = to, type = type }):tag("body"):text(text)); end +function riddim_mt:send_presence(to, type) + self:send(st.presence({ to = to, type = type })); +end + function riddim_mt:add_plugin(name) if not self.plugins[name] then self.plugins[name] = require("riddim.plugins."..name);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/presence.lua Thu May 20 14:36:14 2010 +0100 @@ -0,0 +1,8 @@ + +function riddim.plugins.presence(bot) + bot:hook("presence", function (presence) + if presence.stanza.attr.type ~= 'subscribe' then return nil; end + bot:send_presence(presence.sender.jid, 'subscribed'); + return false; + end); +end
--- a/squishy Thu May 20 14:34:22 2010 +0100 +++ b/squishy Thu May 20 14:36:14 2010 +0100 @@ -1,3 +1,4 @@ +Module "riddim.plugins.presence" "plugins/presence.lua" Module "riddim.plugins.groupchat" "plugins/groupchat.lua" Module "riddim.plugins.commands" "plugins/commands.lua" Module "riddim.plugins.version" "plugins/version.lua"