Fix the last couple of places where we send strings from mod_dialback

Fri, 05 Dec 2008 05:28:16 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 05 Dec 2008 05:28:16 +0000
changeset 560
6c07f15a34f4
parent 559
fa4a51fe6442
child 561
e2a88796cdce
child 570
f40928c94933

Fix the last couple of places where we send strings from mod_dialback

plugins/mod_dialback.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_dialback.lua	Fri Dec 05 05:23:42 2008 +0000
+++ b/plugins/mod_dialback.lua	Fri Dec 05 05:28:16 2008 +0000
@@ -19,7 +19,6 @@
 
 
 
-local format = string.format;
 local send_s2s = require "core.s2smanager".send_to_host;
 local s2s_make_authenticated = require "core.s2smanager".make_authenticated;
 local s2s_verify_dialback = require "core.s2smanager".verify_dialback;
@@ -45,7 +44,7 @@
 			log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to);
 		end
 		log("debug", "verified dialback key... it is %s", type);
-		origin.sends2s(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1]));
+		origin.sends2s(st.stanza("db:verify", { from = attr.to, to = attr.from, id = attr.id, type = type }):text(stanza[1]));
 	end);
 
 module:add_handler("s2sin_unauthed", "result", xmlns_dialback,
@@ -79,8 +78,9 @@
 			if not origin.dialback_verifying.sends2s then
 				log("warn", "Incoming s2s session %s was closed in the meantime, so we can't notify it of the db result", tostring(origin.dialback_verifying):match("%w+$"));
 			else
-				origin.dialback_verifying.sends2s(format("<db:result from='%s' to='%s' id='%s' type='%s'>%s</db:result>",
-					attr.to, attr.from, attr.id, valid, origin.dialback_verifying.dialback_key));
+				origin.dialback_verifying.sends2s(
+						st.stanza("db:result", { from = attr.to, to = attr.from, id = attr.id, type = valid })
+								:text(origin.dialback_verifying.dialback_key));
 			end
 		end
 	end);

mercurial