41 |
41 |
42 local last_message_time = 0; |
42 local last_message_time = 0; |
43 |
43 |
44 function riddim.plugins.pubsub2room(bot) |
44 function riddim.plugins.pubsub2room(bot) |
45 local bare_jid = require "util.jid".bare; |
45 local bare_jid = require "util.jid".bare; |
46 bot:add_plugin("pubsub"); |
46 bot.stream:add_plugin("pubsub"); |
47 |
47 |
48 local config = bot.config.pubsub2room; |
48 local config = bot.config.pubsub2room; |
49 bot:hook("pubsub/event", function(event) |
49 bot.stream:hook("pubsub/event", function(event) |
50 local conf = config[event.from .. "#" .. event.node]; |
50 local conf = config[event.from .. "#" .. event.node]; |
51 local room = bot.rooms[conf.room]; |
51 local room = bot.rooms[conf.room]; |
52 local data = st.stanza(""):tag("id"):text(event.item.attr.id); |
52 local data = st.stanza(""):tag("id"):text(event.item.attr.id); |
53 local entry = event.item and new_extractor(event.item.tags[1], data) |
53 local entry = event.item and new_extractor(event.item.tags[1], data) |
54 |
54 |