Mercurial > prosody-modules
comparison mod_bidi/mod_bidi.lua @ 1128:6b344b7e4781
mod_bidi: Allow route/remote event to continue if we couldn't send a stanza (in case the session was destroyed)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 03 Aug 2013 00:56:15 +0200 |
parents | 38e56be11584 |
children | ae0fa4d2005d |
comparison
equal
deleted
inserted
replaced
1127:38e56be11584 | 1128:6b344b7e4781 |
---|---|
56 end | 56 end |
57 | 57 |
58 module:hook("route/remote", function(event) | 58 module:hook("route/remote", function(event) |
59 local from_host, to_host, stanza = event.from_host, event.to_host, event.stanza; | 59 local from_host, to_host, stanza = event.from_host, event.to_host, event.stanza; |
60 if from_host ~= module.host then return end | 60 if from_host ~= module.host then return end |
61 local to_session = bidi_sessions[to_host] | 61 local to_session = bidi_sessions[to_host]; |
62 if not to_session or to_session.type ~= "s2sin" then return end | 62 if not to_session or to_session.type ~= "s2sin" then return end |
63 return to_session.sends2s(stanza); | 63 if to_session.send(stanza) then return true end |
64 end, -2); | 64 end, -2); |
65 | 65 |
66 -- Incoming s2s | 66 -- Incoming s2s |
67 module:hook("s2s-stream-features", function(event) | 67 module:hook("s2s-stream-features", function(event) |
68 local origin, features = event.origin, event.features; | 68 local origin, features = event.origin, event.features; |