Software /
code /
prosody
Comparison
core/stanza_router.lua @ 372:e7c1e30d06d5
Now possible to specify nil origin to core_route_stanza. Origin will be chosen as the host of the 'from' attribute on the stanza. Returns false on no such host.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 21 Nov 2008 05:59:03 +0000 |
parent | 360:e918c979ad1a |
child | 438:193f9dd64f17 |
comparison
equal
deleted
inserted
replaced
371:0dc5819660e8 | 372:e7c1e30d06d5 |
---|---|
206 local to_bare = node and (node.."@"..host) or host; -- bare JID | 206 local to_bare = node and (node.."@"..host) or host; -- bare JID |
207 local from = stanza.attr.from; | 207 local from = stanza.attr.from; |
208 local from_node, from_host, from_resource = jid_split(from); | 208 local from_node, from_host, from_resource = jid_split(from); |
209 local from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID | 209 local from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID |
210 | 210 |
211 -- Auto-detect origin if not specified | |
212 origin = origin or hosts[from_host]; | |
213 if not origin then return false; end | |
214 | |
211 if stanza.name == "presence" and (stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable") then resource = nil; end | 215 if stanza.name == "presence" and (stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable") then resource = nil; end |
212 | 216 |
213 local host_session = hosts[host] | 217 local host_session = hosts[host] |
214 if host_session and host_session.type == "local" then | 218 if host_session and host_session.type == "local" then |
215 -- Local host | 219 -- Local host |