Mercurial > prosody-hg
comparison plugins/mod_c2s.lua @ 4852:9cc934f49df0
mod_c2s: Another lurking string.format squashed.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 11 May 2012 14:57:29 +0100 |
| parents | 142e21f6bf8e |
| children | c9b8ec3eb1e9 |
comparison
equal
deleted
inserted
replaced
| 4851:8e3992ae7bf5 | 4852:9cc934f49df0 |
|---|---|
| 15 local st = require "util.stanza"; | 15 local st = require "util.stanza"; |
| 16 local sm_new_session, sm_destroy_session = sessionmanager.new_session, sessionmanager.destroy_session; | 16 local sm_new_session, sm_destroy_session = sessionmanager.new_session, sessionmanager.destroy_session; |
| 17 local uuid_generate = require "util.uuid".generate; | 17 local uuid_generate = require "util.uuid".generate; |
| 18 | 18 |
| 19 local xpcall, tostring, type = xpcall, tostring, type; | 19 local xpcall, tostring, type = xpcall, tostring, type; |
| 20 local format = string.format; | |
| 21 local traceback = debug.traceback; | 20 local traceback = debug.traceback; |
| 22 | 21 |
| 23 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams"; | 22 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams"; |
| 24 | 23 |
| 25 local log = module._log; | 24 local log = module._log; |
| 52 -- We don't serve this host... | 51 -- We don't serve this host... |
| 53 session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; | 52 session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; |
| 54 return; | 53 return; |
| 55 end | 54 end |
| 56 | 55 |
| 57 send("<?xml version='1.0'?>"); | 56 send("<?xml version='1.0'?>"..st.stanza("stream:stream", { |
| 58 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)); | 57 xmlns = 'jabber:client', ["xmlns:stream"] = 'http://etherx.jabber.org/streams'; |
| 58 id = session.streamid, from = session.host, version = '1.0', ["xml:lang"] = 'en' }):top_tag()); | |
| 59 | 59 |
| 60 (session.log or log)("debug", "Sent reply <stream:stream> to client"); | 60 (session.log or log)("debug", "Sent reply <stream:stream> to client"); |
| 61 session.notopen = nil; | 61 session.notopen = nil; |
| 62 | 62 |
| 63 -- If session.secure is *false* (not nil) then it means we /were/ encrypting | 63 -- If session.secure is *false* (not nil) then it means we /were/ encrypting |
