clix/message.lua

Wed, 06 Jan 2010 03:50:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 06 Jan 2010 03:50:37 +0000
changeset 0
ae83411a89c9
child 9
c1d591488695
permissions
-rw-r--r--

Initial commit

0
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 return function (opts, arg)
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 if #arg == 0 or opts.help then
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 return 0;
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local function on_connect(conn)
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 conn:send(verse.message({ to = opts.to, type = opts.type or "chat" }):body(table.concat(arg, " ")));
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 conn:close();
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 clix_connect(opts, on_connect);
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 end

mercurial