Software /
code /
prosody-modules
Comparison
mod_s2soutinjection/mod_s2soutinjection.lua @ 5102:9eed88ac8ee8
mod_s2soutinjection: Use module logging API
_G.log exists but modules should normally use module:log(), or
session.log where applicable.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 Dec 2022 22:05:13 +0100 |
parent | 5101:801ca82b6538 |
child | 5103:4fb922aa0ace |
comparison
equal
deleted
inserted
replaced
5101:801ca82b6538 | 5102:9eed88ac8ee8 |
---|---|
67 | 67 |
68 module:hook("route/remote", function(event) | 68 module:hook("route/remote", function(event) |
69 local from_host, to_host, stanza = event.from_host, event.to_host, event.stanza; | 69 local from_host, to_host, stanza = event.from_host, event.to_host, event.stanza; |
70 local inject = injected and injected[to_host]; | 70 local inject = injected and injected[to_host]; |
71 if not inject then return end | 71 if not inject then return end |
72 log("debug", "opening a new outgoing connection for this stanza"); | 72 module:log("debug", "opening a new outgoing connection for this stanza"); |
73 local host_session = new_outgoing(from_host, to_host); | 73 local host_session = new_outgoing(from_host, to_host); |
74 | 74 |
75 -- Store in buffer | 75 -- Store in buffer |
76 host_session.bounce_sendq = bounce_sendq; | 76 host_session.bounce_sendq = bounce_sendq; |
77 host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; | 77 host_session.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; |
78 log("debug", "stanza [%s] queued until connection complete", tostring(stanza.name)); | 78 module:log("debug", "stanza [%s] queued until connection complete", tostring(stanza.name)); |
79 | 79 |
80 local host, port = inject[1] or inject, tonumber(inject[2]) or 5269; | 80 local host, port = inject[1] or inject, tonumber(inject[2]) or 5269; |
81 | 81 |
82 local conn = addclient(host, port, proxy_listener, "*a"); | 82 local conn = addclient(host, port, proxy_listener, "*a"); |
83 | 83 |