aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/sasl/scram.lua4
-rw-r--r--util/stanza.lua11
2 files changed, 13 insertions, 2 deletions
diff --git a/util/sasl/scram.lua b/util/sasl/scram.lua
index 1e9c6f7d..be82c60e 100644
--- a/util/sasl/scram.lua
+++ b/util/sasl/scram.lua
@@ -70,8 +70,8 @@ local function validate_username(username)
end
-- replace =2D with , and =3D with =
- username:gsub("=2D", ",");
- username:gsub("=3D", "=");
+ username = username:gsub("=2D", ",");
+ username = username:gsub("=3D", "=");
-- apply SASLprep
username = saslprep(username);
diff --git a/util/stanza.lua b/util/stanza.lua
index d295d5cc..8d3b7747 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -93,6 +93,17 @@ function stanza_mt:add_child(child)
return self;
end
+function stanza_mt:get_child(name, xmlns)
+ for _, child in ipairs(self.tags) do
+ if (not name or child.name == name)
+ and ((not xmlns and self.attr.xmlns == child.attr.xmlns)
+ or child.attr.xmlns == xmlns) then
+
+ return child;
+ end
+ end
+end
+
function stanza_mt:child_with_name(name)
for _, child in ipairs(self.tags) do
if child.name == name then return child; end