plugins/mod_pubsub.lua

changeset 3944
74a422abec11
parent 3941
526624f7852e
child 3946
14239141764f
equal deleted inserted replaced
3943:ad5924c31953 3944:74a422abec11
229 add_disco_features_from_service(disco_info, service); 229 add_disco_features_from_service(disco_info, service);
230 return disco_info; 230 return disco_info;
231 end 231 end
232 232
233 module:hook("iq-get/host/http://jabber.org/protocol/disco#info:query", function (event) 233 module:hook("iq-get/host/http://jabber.org/protocol/disco#info:query", function (event)
234 event.origin.send(st.reply(event.stanza):add_child(disco_info)); 234 local origin, stanza = event.origin, event.stanza;
235 return true; 235 local node = stanza.tags[1].attr.node;
236 if not node then
237 return origin.send(st.reply(stanza):add_child(disco_info));
238 else
239 local ok, ret = service:get_nodes(stanza.attr.from);
240 if ok and not ret[node] then
241 ok, ret = false, "item-not-found";
242 end
243 if not ok then
244 return origin.send(pubsub_error_reply(stanza, ret));
245 end
246 local reply = st.reply(stanza)
247 :tag("query", { xmlns = "http://jabber.org/protocol/disco#info", node = node })
248 :tag("identity", { category = "pubsub", type = "leaf" });
249 return origin.send(reply);
250 end
236 end); 251 end);
237 252
238 local function handle_disco_items_on_node(event) 253 local function handle_disco_items_on_node(event)
239 local stanza, origin = event.stanza, event.origin; 254 local stanza, origin = event.stanza, event.origin;
240 local query = stanza.tags[1]; 255 local query = stanza.tags[1];

mercurial