# HG changeset patch # User Chris # Date 1274362574 -3600 # Node ID d7cd7ce93132de54272c2db35a3fd62976e9eda3 # Parent 9fe723988f3cb90854685a2b6ba899d5ddbc146e Rudimentary presence plugin to auto-accept subscription requests diff -r 9fe723988f3c -r d7cd7ce93132 init.lua --- 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); diff -r 9fe723988f3c -r d7cd7ce93132 plugins/presence.lua --- /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 diff -r 9fe723988f3c -r d7cd7ce93132 squishy --- 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"