clix: Allow specifying the resource with -r/--resource

Thu, 07 Jan 2010 02:35:04 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 07 Jan 2010 02:35:04 +0000
changeset 13
751db005032e
parent 12
1793fca3d707
child 14
1e927484c6ec

clix: Allow specifying the resource with -r/--resource

clix.lua file | annotate | diff | comparison | revisions
--- a/clix.lua	Thu Jan 07 02:31:18 2010 +0000
+++ b/clix.lua	Thu Jan 07 02:35:04 2010 +0000
@@ -9,7 +9,7 @@
 require "verse.client"
 
 -- Global to allow commands to add to it
-short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password" }
+short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password", r = "resource" }
 
 local command = arg[1];
 
@@ -79,9 +79,14 @@
 	-- Optional config parameters
 	conn.connect_host = account.address;
 	conn.connect_port = account.port;
+	
 	-- Connect!
 	conn:connect_client(account.jid, account.password);
 	
+	if type(opts.resource) == "string" then
+		conn.resource = opts.resource;
+	end
+	
 	local ok, ret = pcall(verse.loop);
 	if not ok and not ret:match("interrupted!$") then
 		io.stderr:write("Fatal error: ", ret, "\n");

mercurial