clix, clix.raw: Move 'Connected as' to clix_connect(), and suppress on -q/--quiet

Thu, 07 Jan 2010 22:05:25 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 07 Jan 2010 22:05:25 +0000
changeset 23
c5f04bdc7c64
parent 22
19c5a66837ed
child 24
8e157125957d

clix, clix.raw: Move 'Connected as' to clix_connect(), and suppress on -q/--quiet

clix.lua file | annotate | diff | comparison | revisions
clix/raw.lua file | annotate | diff | comparison | revisions
--- a/clix.lua	Thu Jan 07 21:24:47 2010 +0000
+++ b/clix.lua	Thu Jan 07 22:05:25 2010 +0000
@@ -9,8 +9,8 @@
 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", o = "presence", c = "chatroom" }
+short_opts = { v = "verbose", q = "quiet", t = "to", f = "from", e = "type",
+	a = "account", p = "password", r = "resource", o = "presence", c = "chatroom" }
 
 local command = arg[1];
 
@@ -75,7 +75,9 @@
 		conn:close();
 	end);
 	conn:hook("binding-success", function ()
-		conn:debug("Connected: "..tostring(conn));
+		if not opts.quiet then
+			io.stderr:write("clix: connected as ", conn.jid, "\n");
+		end
 		if opts.chatroom then
 			conn:send(verse.presence{to=opts.to.."/"..(opts.nick or "clix")});
 		end
--- a/clix/raw.lua	Thu Jan 07 21:24:47 2010 +0000
+++ b/clix/raw.lua	Thu Jan 07 22:05:25 2010 +0000
@@ -4,7 +4,6 @@
 return function (opts, args)
 	local function on_connect(conn)
 		conn:hook("incoming-raw", print);
-		io.stderr:write("Connected as ", conn.jid, "\n");
 		if opts.interactive or opts.stdin then
 			local stdin = {
 				getfd = function () return 0; end;

mercurial