Changeset

13:751db005032e

clix: Allow specifying the resource with -r/--resource
author Matthew Wild <mwild1@gmail.com>
date Thu, 07 Jan 2010 02:35:04 +0000
parents 12:1793fca3d707
children 14:1e927484c6ec
files clix.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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");