util/sasl_cyrus.lua
changeset 3365 32dc830d976c
parent 3363 a4bb658d3fcb
child 3366 a2a242321901
--- a/util/sasl_cyrus.lua	Wed Jul 14 20:05:25 2010 +0500
+++ b/util/sasl_cyrus.lua	Wed Jul 14 20:10:35 2010 +0500
@@ -129,12 +129,15 @@
 
 -- 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