36 return true; |
36 return true; |
37 end |
37 end |
38 |
38 |
39 |
39 |
40 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; |
40 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; |
41 local function session_disconnect(session, reason) |
41 local function session_close(session, reason) |
42 local log = session.log or log; |
42 local log = session.log or log; |
43 if session.conn then |
43 if session.conn then |
44 if reason then |
44 if reason then |
45 if type(reason) == "string" then -- assume stream error |
45 if type(reason) == "string" then -- assume stream error |
46 log("info", "Disconnecting client, <stream:error> is: %s", reason); |
46 log("info", "Disconnecting client, <stream:error> is: %s", reason); |
88 session.log = log; |
88 session.log = log; |
89 |
89 |
90 print("Client connected"); |
90 print("Client connected"); |
91 |
91 |
92 session.reset_stream = session_reset_stream; |
92 session.reset_stream = session_reset_stream; |
93 session.disconnect = session_disconnect; |
93 session.close = session_close; |
94 |
94 |
95 session_reset_stream(session); -- Initialise, ready for use |
95 session_reset_stream(session); -- Initialise, ready for use |
96 |
96 |
97 -- TODO: Below function should be session,stanza - and xmlhandlers should use :method() notation to call, |
97 -- TODO: Below function should be session,stanza - and xmlhandlers should use :method() notation to call, |
98 -- this will avoid the useless indirection we have atm |
98 -- this will avoid the useless indirection we have atm |