Software / code / prosody
Comparison
core/stanza_router.lua @ 1144:fbd65e966316
Merge with 0.4
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 13 May 2009 16:55:20 +0100 |
| parent | 1142:0e02b3301e80 |
| parent | 1143:5bab3eb566ad |
| child | 1148:5dafbc0ded34 |
comparison
equal
deleted
inserted
replaced
| 1142:0e02b3301e80 | 1144:fbd65e966316 |
|---|---|
| 78 local from_node, from_host, from_resource; | 78 local from_node, from_host, from_resource; |
| 79 local to_bare, from_bare; | 79 local to_bare, from_bare; |
| 80 if to then | 80 if to then |
| 81 node, host, resource = jid_prepped_split(to); | 81 node, host, resource = jid_prepped_split(to); |
| 82 if not host then | 82 if not host then |
| 83 error("Invalid to JID"); | 83 log("warn", "Received stanza with invalid destination JID: %s", to); |
| 84 origin.send(st.error_reply(stanza, "modify", "jid-malformed", "The destination address is invalid: "..to)); | |
| 85 return; | |
| 84 end | 86 end |
| 85 to_bare = node and (node.."@"..host) or host; -- bare JID | 87 to_bare = node and (node.."@"..host) or host; -- bare JID |
| 86 if resource then to = to_bare.."/"..resource; else to = to_bare; end | 88 if resource then to = to_bare.."/"..resource; else to = to_bare; end |
| 87 stanza.attr.to = to; | 89 stanza.attr.to = to; |
| 88 end | 90 end |
| 89 if from then | 91 if from then |
| 92 -- We only stamp the 'from' on c2s stanzas, so we still need to check validity | |
| 90 from_node, from_host, from_resource = jid_prepped_split(from); | 93 from_node, from_host, from_resource = jid_prepped_split(from); |
| 91 if not from_host then | 94 if not from_host then |
| 92 error("Invalid from JID"); | 95 log("warn", "Received stanza with invalid source JID: %s", from); |
| 96 origin.send(st.error_reply(stanza, "modify", "jid-malformed", "The source address is invalid: "..from)); | |
| 97 return; | |
| 93 end | 98 end |
| 94 from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID | 99 from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID |
| 95 if from_resource then from = from_bare.."/"..from_resource; else from = from_bare; end | 100 if from_resource then from = from_bare.."/"..from_resource; else from = from_bare; end |
| 96 stanza.attr.from = from; | 101 stanza.attr.from = from; |
| 97 end | 102 end |