Comparison

plugins/mod_s2s/mod_s2s.lua @ 5800:3a48acbcb7f3

mod_s2s: Captitalize log messages that begin with a stream direction
author Kim Alvefur <zash@zash.se>
date Wed, 14 Aug 2013 14:53:50 +0200
parent 5776:bd0ff8ae98a8
child 5801:224644752bf4
comparison
equal deleted inserted replaced
5799:4a7e90b4c97d 5800:3a48acbcb7f3
156 function mark_connected(session) 156 function mark_connected(session)
157 local sendq, send = session.sendq, session.sends2s; 157 local sendq, send = session.sendq, session.sends2s;
158 158
159 local from, to = session.from_host, session.to_host; 159 local from, to = session.from_host, session.to_host;
160 160
161 session.log("info", "%s s2s connection %s->%s complete", session.direction, from, to); 161 session.log("info", "%s s2s connection %s->%s complete", session.direction:gsub("^.", string.upper), from, to);
162 162
163 local event_data = { session = session }; 163 local event_data = { session = session };
164 if session.type == "s2sout" then 164 if session.type == "s2sout" then
165 fire_global_event("s2sout-established", event_data); 165 fire_global_event("s2sout-established", event_data);
166 hosts[from].events.fire_event("s2sout-established", event_data); 166 hosts[from].events.fire_event("s2sout-established", event_data);
489 489
490 session.sends2s("</stream:stream>"); 490 session.sends2s("</stream:stream>");
491 function session.sends2s() return false; end 491 function session.sends2s() return false; end
492 492
493 local reason = remote_reason or (reason and (reason.text or reason.condition)) or reason; 493 local reason = remote_reason or (reason and (reason.text or reason.condition)) or reason;
494 session.log("info", "%s s2s stream %s->%s closed: %s", session.direction, session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed"); 494 session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed");
495 495
496 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote 496 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote
497 local conn = session.conn; 497 local conn = session.conn;
498 if reason == nil and not session.notopen and session.type == "s2sin" then 498 if reason == nil and not session.notopen and session.type == "s2sin" then
499 add_task(stream_close_timeout, function () 499 add_task(stream_close_timeout, function ()