5 if (#arg == 0 or opts.help) and not opts.interactive then |
5 if (#arg == 0 or opts.help) and not opts.interactive then |
6 return 0; |
6 return 0; |
7 end |
7 end |
8 local function on_connect(conn) |
8 local function on_connect(conn) |
9 local function send_message(text) |
9 local function send_message(text) |
10 conn:send(verse.message({ to = opts.to, type = opts.type or "chat" }):body(text)); |
10 conn:send(verse.message({ to = opts.to, |
|
11 type = opts.type or (opts.chatroom and "groupchat") or "chat" }) |
|
12 :body(text)); |
11 end |
13 end |
12 if opts.interactive or opts.stdin then |
14 if opts.interactive or opts.stdin then |
13 -- Fake socket object around stdin |
15 -- Fake socket object around stdin |
14 local stdin = { |
16 local stdin = { |
15 getfd = function () return 0; end; |
17 getfd = function () return 0; end; |