Software /
code /
verse
Comparison
plugins/pep.lua @ 470:e690759c5072
pep: Include item id in event
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 17 Mar 2023 09:27:27 +0000 |
parent | 415:37674f8ce263 |
comparison
equal
deleted
inserted
replaced
469:b49d5df43a4c | 470:e690759c5072 |
---|---|
7 stream:add_plugin("disco"); | 7 stream:add_plugin("disco"); |
8 stream:add_plugin("pubsub"); | 8 stream:add_plugin("pubsub"); |
9 stream.pep = {}; | 9 stream.pep = {}; |
10 | 10 |
11 stream:hook("pubsub/event", function(event) | 11 stream:hook("pubsub/event", function(event) |
12 return stream:event("pep/"..event.node, { from = event.from, item = event.item.tags[1] } ); | 12 return stream:event("pep/"..event.node, { from = event.from, id = event.item.attr.id, item = event.item.tags[1] } ); |
13 end); | 13 end); |
14 | 14 |
15 function stream:hook_pep(node, callback, priority) | 15 function stream:hook_pep(node, callback, priority) |
16 local handlers = stream.events._handlers["pep/"..node]; | 16 local handlers = stream.events._handlers["pep/"..node]; |
17 if not(handlers) or #handlers == 0 then | 17 if not(handlers) or #handlers == 0 then |