util.sasl: New method to add channel binding handler to a SASL instance.
authorTobias Markmann <tm@ayena.de>
Mon, 17 Jan 2011 16:50:21 +0100
changeset 5831 aa4bdabd3c0f
parent 5830 ae48bf828f21
child 5832 7d100d917243
util.sasl: New method to add channel binding handler to a SASL instance.
util/sasl.lua
--- a/util/sasl.lua	Mon Jan 17 16:50:21 2011 +0100
+++ b/util/sasl.lua	Mon Jan 17 16:50:21 2011 +0100
@@ -70,6 +70,15 @@
 	return setmetatable({ profile = profile, realm = realm, mechs = mechanisms }, method);
 end
 
+-- add a channel binding handler
+function method:add_cb_handler(name, f)
+	if type(self.profile.cb) ~= "table" then
+		self.profile.cb = {};
+	end
+	self.profile.cb[name] = f;
+	return self;
+end
+
 -- get a fresh clone with the same realm and profile
 function method:clean_clone()
 	return new(self.realm, self.profile)