Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 970:5516f9e66482
sessionmanager, componentmanager: Fix some wacky indentation (thanks greyback!)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 08 Apr 2009 23:20:22 +0100 |
parent | 959:e3db909065f2 |
child | 1076:ba3639692493 |
comparison
equal
deleted
inserted
replaced
965:8bc06338aac3 | 970:5516f9e66482 |
---|---|
153 | 153 |
154 return true; | 154 return true; |
155 end | 155 end |
156 | 156 |
157 function streamopened(session, attr) | 157 function streamopened(session, attr) |
158 local send = session.send; | 158 local send = session.send; |
159 session.host = attr.to or error("Client failed to specify destination hostname"); | 159 session.host = attr.to or error("Client failed to specify destination hostname"); |
160 session.host = nameprep(session.host); | 160 session.host = nameprep(session.host); |
161 session.version = tonumber(attr.version) or 0; | 161 session.version = tonumber(attr.version) or 0; |
162 session.streamid = m_random(1000000, 99999999); | 162 session.streamid = m_random(1000000, 99999999); |
163 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); | 163 (session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host); |
164 | 164 |
165 send("<?xml version='1.0'?>"); | |
166 send(format("<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='%s' from='%s' version='1.0'>", session.streamid, session.host)); | |
167 | |
168 if not hosts[session.host] then | |
169 -- We don't serve this host... | |
170 session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; | |
171 return; | |
172 end | |
165 | 173 |
166 send("<?xml version='1.0'?>"); | 174 local features = st.stanza("stream:features"); |
167 send(format("<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='%s' from='%s' version='1.0'>", session.streamid, session.host)); | 175 fire_event("stream-features", session, features); |
168 | 176 |
169 if not hosts[session.host] then | 177 send(features); |
170 -- We don't serve this host... | 178 |
171 session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; | 179 (session.log or log)("info", "Sent reply <stream:stream> to client"); |
172 return; | 180 session.notopen = nil; |
173 end | |
174 | |
175 | |
176 local features = st.stanza("stream:features"); | |
177 fire_event("stream-features", session, features); | |
178 | |
179 send(features); | |
180 | |
181 (session.log or log)("info", "Sent reply <stream:stream> to client"); | |
182 session.notopen = nil; | |
183 end | 181 end |
184 | 182 |
185 function streamclosed(session) | 183 function streamclosed(session) |
186 session.send("</stream:stream>"); | 184 session.send("</stream:stream>"); |
187 session.notopen = true; | 185 session.notopen = true; |