diff options
author | Waqas Hussain <waqas20@gmail.com> | 2008-12-04 20:01:57 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2008-12-04 20:01:57 +0500 |
commit | d6e4398a6a8c2b8bc4ca44141d7f3decee7a6bf4 (patch) | |
tree | a617df53e84e81f0174d73376cefd15c03c08017 /util/discohelper.lua | |
parent | 11538c72c66d63aa440373558f36f646a2985ec1 (diff) | |
download | prosody-d6e4398a6a8c2b8bc4ca44141d7f3decee7a6bf4.tar.gz prosody-d6e4398a6a8c2b8bc4ca44141d7f3decee7a6bf4.zip |
Reorder the disco info elements to place always included elements first
Diffstat (limited to 'util/discohelper.lua')
-rw-r--r-- | util/discohelper.lua | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/util/discohelper.lua b/util/discohelper.lua index 4d3bc3f6..7966ac55 100644 --- a/util/discohelper.lua +++ b/util/discohelper.lua @@ -57,20 +57,8 @@ local function handle(self, stanza) elseif query.attr.xmlns == "http://jabber.org/protocol/disco#items" then
handlers = self.item_handlers;
end
- local handler = handlers[to]; -- get the handler
- if not handler then -- if not found then use default handler
- if to_node then
- handler = handlers["*defaultnode"];
- else
- handler = handlers["*defaulthost"];
- end
- end
- local found; -- to keep track of any handlers found
- if handler then
- for _, h in ipairs(handler) do
- if h(reply, to, from, node) then found = true; end
- end
- end
+ local handler; + local found; -- to keep track of any handlers found if to_node then -- handlers which get called always
handler = handlers["*node"];
else
@@ -81,6 +69,19 @@ local function handle(self, stanza) if h(reply, to, from, node) then found = true; end
end
end
+ handler = handlers[to]; -- get the handler + if not handler then -- if not found then use default handler + if to_node then + handler = handlers["*defaultnode"]; + else + handler = handlers["*defaulthost"]; + end + end + if handler then + for _, h in ipairs(handler) do + if h(reply, to, from, node) then found = true; end + end + end if found then return reply; end -- return the reply if there was one
return st.error_reply(stanza, "cancel", "service-unavailable");
end
|