aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl_cyrus.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-07-14 20:10:35 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-07-14 20:10:35 +0500
commit81c3a58d1fed9f0e5713d005181b871c12843fd3 (patch)
tree5befdaef4fc6392648e1979577bf19cbec1e4516 /util/sasl_cyrus.lua
parentd9319436f0a9e592f57fbc1958a2e2936cc3e675 (diff)
downloadprosody-81c3a58d1fed9f0e5713d005181b871c12843fd3.tar.gz
prosody-81c3a58d1fed9f0e5713d005181b871c12843fd3.zip
util.sasl, util.sasl_cyrus: Updated method:mechanisms() to cache and re-use list of mechanisms.
Diffstat (limited to 'util/sasl_cyrus.lua')
-rw-r--r--util/sasl_cyrus.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/util/sasl_cyrus.lua b/util/sasl_cyrus.lua
index b03174f5..5178f7cd 100644
--- a/util/sasl_cyrus.lua
+++ b/util/sasl_cyrus.lua
@@ -129,12 +129,15 @@ end
-- get a list of possible SASL mechanims to use
function method:mechanisms()
- local mechanisms = {}
- local cyrus_mechs = cyrussasl.listmech(self.cyrus, nil, "", " ", "")
- for w in s_gmatch(cyrus_mechs, "[^ ]+") do
- mechanisms[w] = true;
+ local mechanisms = self.mechs;
+ if not mechanisms then
+ mechanisms = {}
+ local cyrus_mechs = cyrussasl.listmech(self.cyrus, nil, "", " ", "")
+ for w in s_gmatch(cyrus_mechs, "[^ ]+") do
+ mechanisms[w] = true;
+ end
+ self.mechs = mechanisms
end
- self.mechs = mechanisms
return mechanisms;
end