Comparison

plugins/mod_pep.lua @ 1404:12abd2da8885

mod_pep: Use new style events
author Waqas Hussain <waqas20@gmail.com>
date Wed, 24 Jun 2009 20:09:44 +0500
parent 1402:34723bbd5acb
child 1424:6969ad97ca58
comparison
equal deleted inserted replaced
1403:a1762cfd4d83 1404:12abd2da8885
71 end 71 end
72 end 72 end
73 end 73 end
74 end, 10); 74 end, 10);
75 75
76 module:add_iq_handler("c2s", "http://jabber.org/protocol/pubsub", function (session, stanza) 76 module:hook("iq/bare/http://jabber.org/protocol/pubsub:pubsub", function(event)
77 local session, stanza = event.origin, event.stanza;
77 if stanza.attr.type == 'set' and (not stanza.attr.to or jid_bare(stanza.attr.from) == stanza.attr.to) then 78 if stanza.attr.type == 'set' and (not stanza.attr.to or jid_bare(stanza.attr.from) == stanza.attr.to) then
78 local payload = stanza.tags[1]; 79 local payload = stanza.tags[1];
79 if payload.name == 'pubsub' then -- <pubsub xmlns='http://jabber.org/protocol/pubsub'> 80 if payload.name == 'pubsub' then -- <pubsub xmlns='http://jabber.org/protocol/pubsub'>
80 payload = payload.tags[1]; 81 payload = payload.tags[1];
81 if payload and payload.name == 'publish' and payload.attr.node then -- <publish node='http://jabber.org/protocol/tune'> 82 if payload and payload.name == 'publish' and payload.attr.node then -- <publish node='http://jabber.org/protocol/tune'>
86 return true; 87 return true;
87 end -- TODO else error 88 end -- TODO else error
88 end -- TODO else error 89 end -- TODO else error
89 end 90 end
90 end 91 end
91 session.send(st.error_reply(stanza, "cancel", "service-unavailable"));
92 end); 92 end);
93 93