Comparison

core/modulemanager.lua @ 1707:c55aa091f42a

modulemanager: Removed legacy disco#items hook
author Waqas Hussain <waqas20@gmail.com>
date Tue, 18 Aug 2009 12:52:44 +0500
parent 1706:0e6ba1678d8e
child 1708:ac792c01dfcb
comparison
equal deleted inserted replaced
1706:0e6ba1678d8e 1707:c55aa091f42a
326 end 326 end
327 function api:add_iq_handler(origin_type, xmlns, handler) 327 function api:add_iq_handler(origin_type, xmlns, handler)
328 self:add_handler(origin_type, "iq", xmlns, handler); 328 self:add_handler(origin_type, "iq", xmlns, handler);
329 end 329 end
330 330
331 addDiscoInfoHandler("*host", function(reply, to, from, node)
332 if #node == 0 then
333 local done = {};
334 for module, identities in pairs(identities_table:get(to) or NULL) do -- for each module
335 for identity, attr in pairs(identities) do
336 if not done[identity] then
337 reply:tag("identity", attr):up(); -- TODO cache
338 done[identity] = true;
339 end
340 end
341 end
342 for module, identities in pairs(identities_table:get("*") or NULL) do -- for each module
343 for identity, attr in pairs(identities) do
344 if not done[identity] then
345 reply:tag("identity", attr):up(); -- TODO cache
346 done[identity] = true;
347 end
348 end
349 end
350 for module, features in pairs(features_table:get(to) or NULL) do -- for each module
351 for feature in pairs(features) do
352 if not done[feature] then
353 reply:tag("feature", {var = feature}):up(); -- TODO cache
354 done[feature] = true;
355 end
356 end
357 end
358 for module, features in pairs(features_table:get("*") or NULL) do -- for each module
359 for feature in pairs(features) do
360 if not done[feature] then
361 reply:tag("feature", {var = feature}):up(); -- TODO cache
362 done[feature] = true;
363 end
364 end
365 end
366 return next(done) ~= nil;
367 end
368 end);
369
370 function api:add_feature(xmlns) 331 function api:add_feature(xmlns)
371 self:add_item("feature", xmlns); 332 self:add_item("feature", xmlns);
372 end 333 end
373 function api:add_identity(category, type, name) 334 function api:add_identity(category, type, name)
374 self:add_item("identity", {category = category, type = type, name = name}); 335 self:add_item("identity", {category = category, type = type, name = name});