diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-01-22 23:57:13 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-01-22 23:57:13 +0000 |
commit | 70b25deb380e7ce510cb9ff1b0be2cd579d28692 (patch) | |
tree | a6c4f21ed609b698e65fd2c7ccc639ba4a8f7e63 /core/sessionmanager.lua | |
parent | 346ca73cc20ec8f286be470b1f4f5910f5216b8c (diff) | |
download | prosody-70b25deb380e7ce510cb9ff1b0be2cd579d28692.tar.gz prosody-70b25deb380e7ce510cb9ff1b0be2cd579d28692.zip |
mod_c2s, sessionmanager, xmppclient_listener: Move all c2s network and stream logic into a new module, mod_c2s
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r-- | core/sessionmanager.lua | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index b1ec819f..17c718dc 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -6,11 +6,8 @@ -- COPYING file in the source package for more information. -- - - local tonumber, tostring, setmetatable = tonumber, tostring, setmetatable; local ipairs, pairs, print, next= ipairs, pairs, print, next; -local format = string.format; local hosts = hosts; local full_sessions = full_sessions; @@ -19,10 +16,8 @@ local bare_sessions = bare_sessions; local logger = require "util.logger"; local log = logger.init("sessionmanager"); local error = error; -local uuid_generate = require "util.uuid".generate; local rm_load_roster = require "core.rostermanager".load_roster; local config_get = require "core.configmanager".get; -local nameprep = require "util.encodings".stringprep.nameprep; local resourceprep = require "util.encodings".stringprep.resourceprep; local nodeprep = require "util.encodings".stringprep.nodeprep; @@ -216,50 +211,6 @@ function bind_resource(session, resource) return true; end -function streamopened(session, attr) - local send = session.send; - session.host = attr.to; - if not session.host then - session:close{ condition = "improper-addressing", - text = "A 'to' attribute is required on stream headers" }; - return; - end - session.host = nameprep(session.host); - session.version = tonumber(attr.version) or 0; - session.streamid = uuid_generate(); - (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); - - if not hosts[session.host] then - -- We don't serve this host... - session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; - return; - end - - send("<?xml version='1.0'?>"); - send(format("<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='%s' from='%s' version='1.0' xml:lang='en'>", session.streamid, session.host)); - - (session.log or log)("debug", "Sent reply <stream:stream> to client"); - session.notopen = nil; - - -- If session.secure is *false* (not nil) then it means we /were/ encrypting - -- since we now have a new stream header, session is secured - if session.secure == false then - session.secure = true; - end - - local features = st.stanza("stream:features"); - hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); - fire_event("stream-features", session, features); - - send(features); - -end - -function streamclosed(session) - session.log("debug", "Received </stream:stream>"); - session:close(); -end - function send_to_available_resources(user, host, stanza) local jid = user.."@"..host; local count = 0; |