blob: 1ea8dc3d078b154e5088c2b48f3b4ae72409b923 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
local cqueues = require("cqueues")
local socket = require("cqueues.socket")
function callcmd(conn, cmd)
conn:write(cmd.."\n")
print("response:", conn:read("*l"))
end
local socketpath = "/tmp/albotty.sock"
local conn = socket.connect{path = socketpath}
target,msg = ...
for line in string.gmatch(msg, "[^\n]+") do
callcmd(conn, ("/msg %s %s"):format(target, line))
end
conn:close()
|