# HG changeset patch # User Matthew Wild # Date 1294204374 0 # Node ID ed90aace9adde7564e95a7980d5facd9f65829f4 # Parent 279a3f9f540cf0ac4fe3fd1f5b2302416da3b6c4 mod_dialback: Use stanza:get_text() instead of directly accessing [1] diff -r 279a3f9f540c -r ed90aace9add plugins/mod_dialback.lua --- a/plugins/mod_dialback.lua Wed Jan 05 05:12:22 2011 +0000 +++ b/plugins/mod_dialback.lua Wed Jan 05 05:12:54 2011 +0000 @@ -33,14 +33,14 @@ -- COMPAT: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34 --if attr.from ~= origin.to_host then error("invalid-from"); end local type; - if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza[1]) then + if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza:get_text()) then type = "valid" else type = "invalid" origin.log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to); end origin.log("debug", "verified dialback key... it is %s", type); - origin.sends2s(st.stanza("db:verify", { from = attr.to, to = attr.from, id = attr.id, type = type }):text(stanza[1])); + origin.sends2s(st.stanza("db:verify", { from = attr.to, to = attr.from, id = attr.id, type = type }):text(stanza:get_text())); return true; end end); @@ -52,7 +52,7 @@ -- he wants to be identified through dialback -- We need to check the key with the Authoritative server local attr = stanza.attr; - origin.hosts[attr.from] = { dialback_key = stanza[1] }; + origin.hosts[attr.from] = { dialback_key = stanza:get_text() }; if not hosts[attr.to] then -- Not a host that we serve @@ -72,9 +72,9 @@ origin.to_host = attr.to; end - origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]); + origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza:get_text()); send_s2s(attr.to, attr.from, - st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza[1])); + st.stanza("db:verify", { from = attr.to, to = attr.from, id = origin.streamid }):text(stanza:get_text())); return true; end end);