Comparison

plugins/mod_s2s/s2sout.lib.lua @ 6256:d05627c89c99

mod_s2s: Move filter initialization to common place
author Kim Alvefur <zash@zash.se>
date Thu, 22 May 2014 22:48:06 +0200
parent 6017:ac0879a8190a
child 6632:855085439f7f
comparison
equal deleted inserted replaced
6255:6167f8bc5a6b 6256:d05627c89c99
295 end 295 end
296 296
297 conn = wrapclient(conn, connect_host.addr, connect_port, s2s_listener, "*a"); 297 conn = wrapclient(conn, connect_host.addr, connect_port, s2s_listener, "*a");
298 host_session.conn = conn; 298 host_session.conn = conn;
299 299
300 local filter = initialize_filters(host_session);
301 local w, log = conn.write, host_session.log;
302 host_session.sends2s = function (t)
303 log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?"));
304 if t.name then
305 t = filter("stanzas/out", t);
306 end
307 if t then
308 t = filter("bytes/out", tostring(t));
309 if t then
310 return w(conn, tostring(t));
311 end
312 end
313 end
314
315 -- Register this outgoing connection so that xmppserver_listener knows about it 300 -- Register this outgoing connection so that xmppserver_listener knows about it
316 -- otherwise it will assume it is a new incoming connection 301 -- otherwise it will assume it is a new incoming connection
317 s2s_listener.register_outgoing(conn, host_session); 302 s2s_listener.register_outgoing(conn, host_session);
318 303
319 log("debug", "Connection attempt in progress..."); 304 log("debug", "Connection attempt in progress...");