Software /
code /
prosody
Comparison
core/stanza_router.lua @ 207:90c387884234
A little whitespace fix
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 04 Nov 2008 00:41:40 +0500 |
parent | 200:5e8b3cce798f |
child | 209:e9de0803676d |
child | 212:9d6da9ed9063 |
comparison
equal
deleted
inserted
replaced
206:e30d0e30a0ff | 207:90c387884234 |
---|---|
49 local to = stanza.attr.to; | 49 local to = stanza.attr.to; |
50 -- TODO also, stazas should be returned to their original state before the function ends | 50 -- TODO also, stazas should be returned to their original state before the function ends |
51 if origin.type == "c2s" then | 51 if origin.type == "c2s" then |
52 stanza.attr.from = origin.full_jid; -- quick fix to prevent impersonation (FIXME this would be incorrect when the origin is not c2s) | 52 stanza.attr.from = origin.full_jid; -- quick fix to prevent impersonation (FIXME this would be incorrect when the origin is not c2s) |
53 end | 53 end |
54 | 54 |
55 if not to then | 55 if not to then |
56 core_handle_stanza(origin, stanza); | 56 core_handle_stanza(origin, stanza); |
57 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then | 57 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then |
58 local node, host = jid_split(stanza.attr.to); | 58 local node, host = jid_split(stanza.attr.to); |
59 local to_bare = node and (node.."@"..host) or host; -- bare JID | 59 local to_bare = node and (node.."@"..host) or host; -- bare JID |
76 function core_handle_stanza(origin, stanza) | 76 function core_handle_stanza(origin, stanza) |
77 -- Handlers | 77 -- Handlers |
78 if modules_handle_stanza(origin, stanza) then return; end | 78 if modules_handle_stanza(origin, stanza) then return; end |
79 if origin.type == "c2s" or origin.type == "c2s_unauthed" then | 79 if origin.type == "c2s" or origin.type == "c2s_unauthed" then |
80 local session = origin; | 80 local session = origin; |
81 | 81 |
82 if stanza.name == "presence" and origin.roster then | 82 if stanza.name == "presence" and origin.roster then |
83 if stanza.attr.type == nil or stanza.attr.type == "unavailable" then | 83 if stanza.attr.type == nil or stanza.attr.type == "unavailable" then |
84 for jid in pairs(origin.roster) do -- broadcast to all interested contacts | 84 for jid in pairs(origin.roster) do -- broadcast to all interested contacts |
85 local subscription = origin.roster[jid].subscription; | 85 local subscription = origin.roster[jid].subscription; |
86 if subscription == "both" or subscription == "from" then | 86 if subscription == "both" or subscription == "from" then |
258 end | 258 end |
259 | 259 |
260 function core_route_stanza(origin, stanza) | 260 function core_route_stanza(origin, stanza) |
261 -- Hooks | 261 -- Hooks |
262 --- ...later | 262 --- ...later |
263 | 263 |
264 -- Deliver | 264 -- Deliver |
265 local to = stanza.attr.to; | 265 local to = stanza.attr.to; |
266 local node, host, resource = jid_split(to); | 266 local node, host, resource = jid_split(to); |
267 local to_bare = node and (node.."@"..host) or host; -- bare JID | 267 local to_bare = node and (node.."@"..host) or host; -- bare JID |
268 local from = stanza.attr.from; | 268 local from = stanza.attr.from; |