48 bot.stream:add_plugin("pubsub"); |
48 bot.stream:add_plugin("pubsub"); |
49 |
49 |
50 local config = bot.config.pubsub2room; |
50 local config = bot.config.pubsub2room; |
51 bot.stream:hook("pubsub/event", function(event) |
51 bot.stream:hook("pubsub/event", function(event) |
52 local conf = config[event.from .. "#" .. event.node]; |
52 local conf = config[event.from .. "#" .. event.node]; |
|
53 if not conf then return end |
53 local room = bot.rooms[conf.room]; |
54 local room = bot.rooms[conf.room]; |
54 local data = st.stanza(""):tag("id"):text(event.item.attr.id); |
55 local data = st.stanza(""):tag("id"):text(event.item.attr.id); |
55 local entry = event.item and new_extractor(event.item.tags[1], data) |
56 local entry = event.item and new_extractor(event.item.tags[1], data) |
56 |
57 |
57 if not conf or not entry or not room then return end |
58 if not conf or not entry or not room then return end |