plugins/pubsub2room.lua

changeset 145
565c0c43b063
parent 142
211fa13c7ca2
child 146
e545ba65c9ef
equal deleted inserted replaced
144:68dc84e72bef 145:565c0c43b063
55 local data = st.stanza("data"):tag("id"):text(event.item.attr.id); 55 local data = st.stanza("data"):tag("id"):text(event.item.attr.id);
56 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)
57 57
58 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
59 local message = conf.template:gsub("%${([^}]+)}", entry); 59 local message = conf.template:gsub("%${([^}]+)}", entry);
60 60
61 -- Throttle to 1 message/second so we don't flood the room 61 -- Throttle to 1 message/second so we don't flood the room
62 if os.time() - last_message_time > 0 then 62 if os.time() - last_message_time > 0 then
63 room:send_message(message); 63 room:send_message(message);
64 last_message_time = os.time(); 64 last_message_time = os.time();
65 else 65 else

mercurial