util.stanza: Iterate on childtags instead of all childs.
[prosody.git] / util / pubsub.lua
index 4789dff95960547f648dadd12e1d5c83a4aa1046..811f4a154c3ddbb25ef73183fc9020efcc9cf48e 100644 (file)
@@ -54,6 +54,18 @@ function service:publish(node, actor, id, item)
        return true;
 end
 
+function service:retract(node, actor, id, retract)
+       local node_obj = self.nodes[node];
+       if (not node_obj) or (not node_obj.data[id]) then
+               return false, "item-not-found";
+       end
+       node_obj.data[id] = nil;
+       if retract then
+               self.cb.broadcaster(node, node_obj.subscribers, retract);
+       end
+       return true
+end
+
 function service:get(node, actor, id)
        local node_obj = self.nodes[node];
        if node_obj then
@@ -65,4 +77,8 @@ function service:get(node, actor, id)
        end
 end
 
+function service:get_nodes(actor)
+       return true, self.nodes;
+end
+
 return _M;