Comparison

plugins/pep.lua @ 232:5b49de3aa0f3

plugins.pep: Set item to the first tag instead of first child.
author Kim Alvefur <zash@zash.se>
date Thu, 24 Nov 2011 06:23:43 +0100
parent 216:3aac084855e6
child 249:00891a675634
comparison
equal deleted inserted replaced
231:9712693ae40a 232:5b49de3aa0f3
5 function verse.plugins.pep(stream) 5 function verse.plugins.pep(stream)
6 stream:add_plugin("pubsub"); 6 stream:add_plugin("pubsub");
7 stream.pep = {}; 7 stream.pep = {};
8 8
9 stream:hook("pubsub/event", function(event) 9 stream:hook("pubsub/event", function(event)
10 return stream:event("pep/"..event.node, { from = event.from, item = event.item[1] } ); 10 return stream:event("pep/"..event.node, { from = event.from, item = event.item.tags[1] } );
11 end); 11 end);
12 12
13 function stream:hook_pep(node, callback, priority) 13 function stream:hook_pep(node, callback, priority)
14 local handlers = stream.events._handlers["pep/"..node]; 14 local handlers = stream.events._handlers["pep/"..node];
15 if not(handlers) or #handlers == 0 then 15 if not(handlers) or #handlers == 0 then