From d21570b4f0ccf92b0eba8b0ba35bfad911d7e9b0 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sat, 16 May 2009 02:19:16 +0500 Subject: stanza_router: Improved message routing order --- core/stanza_router.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'core/stanza_router.lua') diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 2413b2cc..eaff7c66 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -160,7 +160,9 @@ function core_route_stanza(origin, stanza) local user = host_session.sessions[node]; if user then local res = user.sessions[resource]; - if not res then + if res then -- resource is online... + res.send(stanza); -- Yay \o/ + else -- if we get here, resource was not specified or was unavailable if stanza.name == "presence" then if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then @@ -211,10 +213,6 @@ function core_route_stanza(origin, stanza) elseif stanza.attr.type == "get" or stanza.attr.type == "set" then origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); end - else - -- User + resource is online... - stanza.attr.to = res.full_jid; -- reset at the end of function - res.send(stanza); -- Yay \o/ end else -- user not online -- cgit v1.2.3