Software /
code /
prosody
Comparison
core/stanza_router.lua @ 780:4417ab6ccc20
Fixed directed presence handling to work correctly for components
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 11 Feb 2009 18:09:41 +0500 |
parent | 760:90ce865eebd8 |
child | 781:191b9f0e5485 |
comparison
equal
deleted
inserted
replaced
779:ec0eadf4e9ff | 780:4417ab6ccc20 |
---|---|
102 local host_status = origin.hosts[from_host]; | 102 local host_status = origin.hosts[from_host]; |
103 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? | 103 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? |
104 log("warn", "Received a stanza claiming to be from %s, over a conn authed for %s!", from_host, origin.from_host); | 104 log("warn", "Received a stanza claiming to be from %s, over a conn authed for %s!", from_host, origin.from_host); |
105 return; -- FIXME what should we do here? does this work with subdomains? | 105 return; -- FIXME what should we do here? does this work with subdomains? |
106 end | 106 end |
107 end | |
108 if origin.type == "c2s" and stanza.name == "presence" and to ~= nil and not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence | |
109 origin.directed = origin.directed or {}; | |
110 origin.directed[to] = true; | |
111 --t_insert(origin.directed, to); -- FIXME does it make more sense to add to_bare rather than to? | |
107 end | 112 end |
108 if not to then | 113 if not to then |
109 core_handle_stanza(origin, stanza); | 114 core_handle_stanza(origin, stanza); |
110 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server | 115 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server |
111 core_handle_stanza(origin, stanza); | 116 core_handle_stanza(origin, stanza); |
120 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then | 125 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then |
121 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); | 126 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); |
122 elseif origin.type ~= "c2s" and stanza.name == "iq" and not resource then -- directed at bare JID | 127 elseif origin.type ~= "c2s" and stanza.name == "iq" and not resource then -- directed at bare JID |
123 core_handle_stanza(origin, stanza); | 128 core_handle_stanza(origin, stanza); |
124 else | 129 else |
125 if origin.type == "c2s" and stanza.name == "presence" and to ~= nil and not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then | |
126 origin.directed = origin.directed or {}; | |
127 t_insert(origin.directed, to); -- FIXME does it make more sense to add to_bare rather than to? | |
128 end | |
129 core_route_stanza(origin, stanza); | 130 core_route_stanza(origin, stanza); |
130 end | 131 end |
131 else | 132 else |
132 core_handle_stanza(origin, stanza); | 133 core_handle_stanza(origin, stanza); |
133 end | 134 end |