Mercurial > prosody-hg
comparison core/s2smanager.lua @ 4822:5ef05f32bc42
mod_s2s, s2smanager, mod_dialback: Move addition of session.send() on s2sin to after they are authenticated (thus from mod_s2s to s2smanager). Update mod_dialback to fire route/remote directly, as session.send() is no longer available for s2sin_unauthed. Fixes #291.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 10 May 2012 22:59:01 +0100 |
| parents | dc70c4ffb66d |
| children | b7a6e86ab87d |
comparison
equal
deleted
inserted
replaced
| 4821:deec69fc33e5 | 4822:5ef05f32bc42 |
|---|---|
| 115 session.log("info", session.direction.." s2s connection "..from.."->"..to.." complete"); | 115 session.log("info", session.direction.." s2s connection "..from.."->"..to.." complete"); |
| 116 | 116 |
| 117 local event_data = { session = session }; | 117 local event_data = { session = session }; |
| 118 if session.type == "s2sout" then | 118 if session.type == "s2sout" then |
| 119 prosody.events.fire_event("s2sout-established", event_data); | 119 prosody.events.fire_event("s2sout-established", event_data); |
| 120 hosts[session.from_host].events.fire_event("s2sout-established", event_data); | 120 hosts[from].events.fire_event("s2sout-established", event_data); |
| 121 else | 121 else |
| 122 local host_session = hosts[to]; | |
| 123 session.send = function(stanza) | |
| 124 host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza }); | |
| 125 end; | |
| 126 | |
| 122 prosody.events.fire_event("s2sin-established", event_data); | 127 prosody.events.fire_event("s2sin-established", event_data); |
| 123 hosts[session.to_host].events.fire_event("s2sin-established", event_data); | 128 hosts[to].events.fire_event("s2sin-established", event_data); |
| 124 end | 129 end |
| 125 | 130 |
| 126 if session.direction == "outgoing" then | 131 if session.direction == "outgoing" then |
| 127 if sendq then | 132 if sendq then |
| 128 session.log("debug", "sending "..#sendq.." queued stanzas across new outgoing connection to "..session.to_host); | 133 session.log("debug", "sending "..#sendq.." queued stanzas across new outgoing connection to "..session.to_host); |
