Software /
code /
clix
Comparison
clix.lua @ 21:cdeb02d9546d
clix, clix.send: Support for chatrooms (-c/--chatroom with --nick=somenick)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 21:22:27 +0000 |
parent | 20:80cc61512f10 |
child | 23:c5f04bdc7c64 |
comparison
equal
deleted
inserted
replaced
20:80cc61512f10 | 21:cdeb02d9546d |
---|---|
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", o = "presence" } | 12 short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", |
13 p = "password", r = "resource", o = "presence", c = "chatroom" } | |
13 | 14 |
14 local command = arg[1]; | 15 local command = arg[1]; |
15 | 16 |
16 if not command then | 17 if not command then |
17 print("Command Line XMPP, available commands:"); | 18 print("Command Line XMPP, available commands:"); |
73 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); | 74 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); |
74 conn:close(); | 75 conn:close(); |
75 end); | 76 end); |
76 conn:hook("binding-success", function () | 77 conn:hook("binding-success", function () |
77 conn:debug("Connected: "..tostring(conn)); | 78 conn:debug("Connected: "..tostring(conn)); |
79 if opts.chatroom then | |
80 conn:send(verse.presence{to=opts.to.."/"..(opts.nick or "clix")}); | |
81 end | |
78 if opts.presence then | 82 if opts.presence then |
79 conn:send(verse.presence()); | 83 conn:send(verse.presence()); |
80 end | 84 end |
81 return on_connect(conn); | 85 return on_connect(conn); |
82 end); | 86 end); |