clix.lua

changeset 17
fa9efbef8a0c
parent 15
54314164a2a3
child 20
80cc61512f10
--- a/clix.lua	Thu Jan 07 19:50:22 2010 +0000
+++ b/clix.lua	Thu Jan 07 20:56:18 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", r = "resource" }
+short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password", r = "resource", o = "presence" }
 
 local command = arg[1];
 
@@ -67,7 +67,13 @@
 		conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or ""));
 		conn:close();
 	end);
-	conn:hook("binding-success", function () conn:debug("Connected: "..tostring(conn)); return on_connect(conn); end);
+	conn:hook("binding-success", function ()
+		conn:debug("Connected: "..tostring(conn));
+		if opts.presence then
+			conn:send(verse.presence());
+		end
+		return on_connect(conn);
+	end);
 	conn:hook("binding-failure", function (err)
 		conn:error("Resource binding failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or ""));
 		conn:close();

mercurial