X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fsasl_cyrus.lua;h=f5bfcbe9f4ea749a387d9df660e95c0dd0eeee26;hb=33d132acecdb68f769087e8f47937bc365f7979f;hp=7d35b5e4866ababb2bbd88fba6c1cbc64959bbdb;hpb=bca1a48421947ca7d627c23433effed81a1d91f2;p=prosody.git diff --git a/util/sasl_cyrus.lua b/util/sasl_cyrus.lua index 7d35b5e4..f5bfcbe9 100644 --- a/util/sasl_cyrus.lua +++ b/util/sasl_cyrus.lua @@ -129,20 +129,22 @@ 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 array.collect(keys(mechanisms)); + return mechanisms; end -- select a mechanism to use function method:select(mechanism) self.mechanism = mechanism; - if not self.mechs then self:mechanisms(); end - return self.mechs[mechanism]; + return self:mechanisms()[mechanism]; end -- feed new messages to process into the library