Comparison

plugins/mod_c2s.lua @ 5776:bd0ff8ae98a8

Remove all trailing whitespace
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 09 Aug 2013 17:48:21 +0200
parent 5773:c9a712673d8a
child 5789:3b05a86631b9
comparison
equal deleted inserted replaced
5775:a6c2b8933507 5776:bd0ff8ae98a8
1 -- Prosody IM 1 -- Prosody IM
2 -- Copyright (C) 2008-2010 Matthew Wild 2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain 3 -- Copyright (C) 2008-2010 Waqas Hussain
4 -- 4 --
5 -- This project is MIT/X11 licensed. Please see the 5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information. 6 -- COPYING file in the source package for more information.
7 -- 7 --
8 8
9 module:set_global(); 9 module:set_global();
152 end 152 end
153 stream_error = tostring(stream_error); 153 stream_error = tostring(stream_error);
154 log("debug", "Disconnecting client, <stream:error> is: %s", stream_error); 154 log("debug", "Disconnecting client, <stream:error> is: %s", stream_error);
155 session.send(stream_error); 155 session.send(stream_error);
156 end 156 end
157 157
158 session.send("</stream:stream>"); 158 session.send("</stream:stream>");
159 function session.send() return false; end 159 function session.send() return false; end
160 160
161 local reason = (reason and (reason.name or reason.text or reason.condition)) or reason; 161 local reason = (reason and (reason.name or reason.text or reason.condition)) or reason;
162 session.log("info", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed"); 162 session.log("info", "c2s stream for %s closed: %s", session.full_jid or ("<"..session.ip..">"), reason or "session closed");
163 163
164 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote 164 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote
165 local conn = session.conn; 165 local conn = session.conn;
191 191
192 --- Port listener 192 --- Port listener
193 function listener.onconnect(conn) 193 function listener.onconnect(conn)
194 local session = sm_new_session(conn); 194 local session = sm_new_session(conn);
195 sessions[conn] = session; 195 sessions[conn] = session;
196 196
197 session.log("info", "Client connected"); 197 session.log("info", "Client connected");
198 198
199 -- Client is using legacy SSL (otherwise mod_tls sets this flag) 199 -- Client is using legacy SSL (otherwise mod_tls sets this flag)
200 if conn:ssl() then 200 if conn:ssl() then
201 session.secure = true; 201 session.secure = true;
202 202
203 -- Check if TLS compression is used 203 -- Check if TLS compression is used
206 session.compressed = sock:info"compression"; 206 session.compressed = sock:info"compression";
207 elseif sock.compression then 207 elseif sock.compression then
208 session.compressed = sock:compression(); --COMPAT mw/luasec-hg 208 session.compressed = sock:compression(); --COMPAT mw/luasec-hg
209 end 209 end
210 end 210 end
211 211
212 if opt_keepalives then 212 if opt_keepalives then
213 conn:setoption("keepalive", opt_keepalives); 213 conn:setoption("keepalive", opt_keepalives);
214 end 214 end
215 215
216 session.close = session_close; 216 session.close = session_close;
217 217
218 local stream = new_xmpp_stream(session, stream_callbacks); 218 local stream = new_xmpp_stream(session, stream_callbacks);
219 session.stream = stream; 219 session.stream = stream;
220 session.notopen = true; 220 session.notopen = true;
221 221
222 function session.reset_stream() 222 function session.reset_stream()
223 session.notopen = true; 223 session.notopen = true;
224 session.stream:reset(); 224 session.stream:reset();
225 end 225 end
226 226
227 session.thread = coroutine.create(function (stanza) 227 session.thread = coroutine.create(function (stanza)
228 while true do 228 while true do
229 core_process_stanza(session, stanza); 229 core_process_stanza(session, stanza);
230 stanza = coroutine.yield("ready"); 230 stanza = coroutine.yield("ready");
231 end 231 end