plugins/pubsub2room.lua

changeset 141
be0754cc0ede
parent 139
6de453570270
child 142
211fa13c7ca2
equal deleted inserted replaced
140:4aa787757235 141:be0754cc0ede
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

mercurial