Software /
code /
verse
Comparison
plugins/pubsub.lua @ 193:fa6e1e65cb3c
plugins.pubsub: Fix to use :childtags() for iterating through items in a pubsub notification (:matching_tags() was removed from Prosody)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 14 Mar 2011 15:17:32 +0000 |
parent | 165:8c67ea868c06 |
child | 221:efb4f60ba36e |
comparison
equal
deleted
inserted
replaced
192:d20feb8034f5 | 193:fa6e1e65cb3c |
---|---|
8 local pubsub_mt = { __index = pubsub }; | 8 local pubsub_mt = { __index = pubsub }; |
9 | 9 |
10 function verse.plugins.pubsub(stream) | 10 function verse.plugins.pubsub(stream) |
11 stream.pubsub = setmetatable({ stream = stream }, pubsub_mt); | 11 stream.pubsub = setmetatable({ stream = stream }, pubsub_mt); |
12 stream:hook("message", function (message) | 12 stream:hook("message", function (message) |
13 for pubsub_event in message:matching_tags("event", xmlns_pubsub_event) do | 13 for pubsub_event in message:childtags("event", xmlns_pubsub_event) do |
14 local items = pubsub_event:get_child("items"); | 14 local items = pubsub_event:get_child("items"); |
15 if items then | 15 if items then |
16 local node = items.attr.node; | 16 local node = items.attr.node; |
17 for item in items:matching_tags("item") do | 17 for item in items:childtags("item") do |
18 stream:event("pubsub/event", { | 18 stream:event("pubsub/event", { |
19 from = message.attr.from; | 19 from = message.attr.from; |
20 node = node; | 20 node = node; |
21 item = item; | 21 item = item; |
22 }); | 22 }); |