clix/send.lua

changeset 21
cdeb02d9546d
parent 18
6ad3ea055905
child 27
5b58c002d6ad
equal deleted inserted replaced
20:80cc61512f10 21:cdeb02d9546d
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;

mercurial