Diff

clix.lua @ 42:4f4fe532a889

clix.lua: clix_connect(): Accept a list of plugins to load for the Verse connection
author Matthew Wild <mwild1@gmail.com>
date Wed, 15 Sep 2010 16:40:14 +0100
parent 41:89070edde205
child 43:1ec64b321834
line wrap: on
line diff
--- a/clix.lua	Wed Sep 15 16:39:38 2010 +0100
+++ b/clix.lua	Wed Sep 15 16:40:14 2010 +0100
@@ -52,7 +52,7 @@
 	end
 end
 
-function clix_connect(opts, on_connect)
+function clix_connect(opts, on_connect, plugins)
 	local account = accounts[opts.account or "default"];
 	if not (account and account.jid) then
 		io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n");
@@ -60,6 +60,9 @@
 	end
 	verse.set_logger(opts.verbose and verse.logger() or function () end);
 	local conn = verse.new(verse.logger());
+	for _, plugin in ipairs(plugins or {}) do
+		conn:add_plugin(plugin);
+	end
 	conn.log.debug = opts.verbose;
 	conn:hook("authentication-failure", function (err)
 		conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or ""));