Diff

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
parent 4753:142e21f6bf8e
child 4964:c9b8ec3eb1e9
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Fri May 11 14:24:05 2012 +0100
+++ b/plugins/mod_c2s.lua	Fri May 11 14:57:29 2012 +0100
@@ -17,7 +17,6 @@
 local uuid_generate = require "util.uuid".generate;
 
 local xpcall, tostring, type = xpcall, tostring, type;
-local format = string.format;
 local traceback = debug.traceback;
 
 local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
@@ -54,8 +53,9 @@
 		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));
+	send("<?xml version='1.0'?>"..st.stanza("stream:stream", {
+		xmlns = 'jabber:client', ["xmlns:stream"] = 'http://etherx.jabber.org/streams';
+		id = session.streamid, from = session.host, version = '1.0', ["xml:lang"] = 'en' }):top_tag());
 
 	(session.log or log)("debug", "Sent reply <stream:stream> to client");
 	session.notopen = nil;