Software /
code /
prosody
Comparison
plugins/mod_disco.lua @ 3600:c888328ae6b3
mod_disco: Updated to use hostmanager.get_children instead of componentmanager.get_children.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 10 Nov 2010 20:31:28 +0500 |
parent | 3572:fb7fc154a56a |
child | 3665:98b55c3a3deb |
comparison
equal
deleted
inserted
replaced
3599:adc0b4df6fdd | 3600:c888328ae6b3 |
---|---|
4 -- | 4 -- |
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | 8 |
9 local componentmanager_get_children = require "core.componentmanager".get_children; | 9 local get_children = require "core.hostmanager".get_children; |
10 local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; | 10 local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; |
11 local jid_split = require "util.jid".split; | 11 local jid_split = require "util.jid".split; |
12 local jid_bare = require "util.jid".bare; | 12 local jid_bare = require "util.jid".bare; |
13 local st = require "util.stanza" | 13 local st = require "util.stanza" |
14 local calculate_hash = require "util.caps".calculate_hash; | 14 local calculate_hash = require "util.caps".calculate_hash; |
99 if stanza.attr.type ~= "get" then return; end | 99 if stanza.attr.type ~= "get" then return; end |
100 local node = stanza.tags[1].attr.node; | 100 local node = stanza.tags[1].attr.node; |
101 if node and node ~= "" then return; end -- TODO fire event? | 101 if node and node ~= "" then return; end -- TODO fire event? |
102 | 102 |
103 local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#items"); | 103 local reply = st.reply(stanza):query("http://jabber.org/protocol/disco#items"); |
104 for jid in pairs(componentmanager_get_children(module.host)) do | 104 for jid in pairs(get_children(module.host)) do |
105 reply:tag("item", {jid = jid}):up(); | 105 reply:tag("item", {jid = jid}):up(); |
106 end | 106 end |
107 for _, item in ipairs(disco_items) do | 107 for _, item in ipairs(disco_items) do |
108 reply:tag("item", {jid=item[1], name=item[2]}):up(); | 108 reply:tag("item", {jid=item[1], name=item[2]}):up(); |
109 end | 109 end |