core/stanza_router.lua

changeset 1169
fdc68aec1d49
parent 1168
dd523bfc9ea9
child 1172
490ff24d0ac5
equal deleted inserted replaced
1168:dd523bfc9ea9 1169:fdc68aec1d49
158 if host_session and host_session.type == "local" then 158 if host_session and host_session.type == "local" then
159 -- Local host 159 -- Local host
160 local user = host_session.sessions[node]; 160 local user = host_session.sessions[node];
161 if user then 161 if user then
162 local res = user.sessions[resource]; 162 local res = user.sessions[resource];
163 if not res then 163 if res then -- resource is online...
164 res.send(stanza); -- Yay \o/
165 else
164 -- if we get here, resource was not specified or was unavailable 166 -- if we get here, resource was not specified or was unavailable
165 if stanza.name == "presence" then 167 if stanza.name == "presence" then
166 if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then 168 if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then
167 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); 169 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza);
168 elseif not resource then -- sender is available or unavailable or error 170 elseif not resource then -- sender is available or unavailable or error
209 end 211 end
210 end 212 end
211 elseif stanza.attr.type == "get" or stanza.attr.type == "set" then 213 elseif stanza.attr.type == "get" or stanza.attr.type == "set" then
212 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); 214 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
213 end 215 end
214 else
215 -- User + resource is online...
216 stanza.attr.to = res.full_jid; -- reset at the end of function
217 res.send(stanza); -- Yay \o/
218 end 216 end
219 else 217 else
220 -- user not online 218 -- user not online
221 if user_exists(node, host) then 219 if user_exists(node, host) then
222 if stanza.name == "presence" then 220 if stanza.name == "presence" then

mercurial