# HG changeset patch # User Matthew Wild # Date 1262897778 0 # Node ID fa9efbef8a0cdfc97848466108850ff417d1d5b9 # Parent 3a1c076d938261e0a33fe7c8fd94de51af66bb3b Move presence sending into clix_connect(), and control with -o/--presence diff -r 3a1c076d9382 -r fa9efbef8a0c clix.lua --- 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(); diff -r 3a1c076d9382 -r fa9efbef8a0c clix/receive.lua --- a/clix/receive.lua Thu Jan 07 19:50:22 2010 +0000 +++ b/clix/receive.lua Thu Jan 07 20:56:18 2010 +0000 @@ -7,7 +7,6 @@ end local function on_connect(conn) conn:hook("message", on_message); - conn:send(verse.presence()); end clix_connect(opts, on_connect); end