Software /
code /
clix
Comparison
clix.lua @ 17:fa9efbef8a0c
Move presence sending into clix_connect(), and control with -o/--presence
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 20:56:18 +0000 |
parent | 15:54314164a2a3 |
child | 20:80cc61512f10 |
comparison
equal
deleted
inserted
replaced
16:3a1c076d9382 | 17:fa9efbef8a0c |
---|---|
7 -- | 7 -- |
8 require "verse" | 8 require "verse" |
9 require "verse.client" | 9 require "verse.client" |
10 | 10 |
11 -- Global to allow commands to add to it | 11 -- Global to allow commands to add to it |
12 short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password", r = "resource" } | 12 short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password", r = "resource", o = "presence" } |
13 | 13 |
14 local command = arg[1]; | 14 local command = arg[1]; |
15 | 15 |
16 if not command then | 16 if not command then |
17 print("Command Line XMPP, available commands:"); | 17 print("Command Line XMPP, available commands:"); |
65 conn.log.debug = opts.verbose; | 65 conn.log.debug = opts.verbose; |
66 conn:hook("authentication-failure", function (err) | 66 conn:hook("authentication-failure", function (err) |
67 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); | 67 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); |
68 conn:close(); | 68 conn:close(); |
69 end); | 69 end); |
70 conn:hook("binding-success", function () conn:debug("Connected: "..tostring(conn)); return on_connect(conn); end); | 70 conn:hook("binding-success", function () |
71 conn:debug("Connected: "..tostring(conn)); | |
72 if opts.presence then | |
73 conn:send(verse.presence()); | |
74 end | |
75 return on_connect(conn); | |
76 end); | |
71 conn:hook("binding-failure", function (err) | 77 conn:hook("binding-failure", function (err) |
72 conn:error("Resource binding failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); | 78 conn:error("Resource binding failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); |
73 conn:close(); | 79 conn:close(); |
74 end); | 80 end); |
75 conn:hook("disconnected", function (info) | 81 conn:hook("disconnected", function (info) |