# HG changeset patch # User Matthew Wild # Date 1262899347 0 # Node ID cdeb02d9546d574d2fa365c5e3c7e1ba9149207f # Parent 80cc61512f10586e2b00dd3de105934052a27c4b clix, clix.send: Support for chatrooms (-c/--chatroom with --nick=somenick) diff -r 80cc61512f10 -r cdeb02d9546d clix.lua --- a/clix.lua Thu Jan 07 20:59:15 2010 +0000 +++ b/clix.lua Thu Jan 07 21:22:27 2010 +0000 @@ -9,7 +9,8 @@ require "verse.client" -- Global to allow commands to add to it -short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password", r = "resource", o = "presence" } +short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", + p = "password", r = "resource", o = "presence", c = "chatroom" } local command = arg[1]; @@ -75,6 +76,9 @@ end); conn:hook("binding-success", function () conn:debug("Connected: "..tostring(conn)); + if opts.chatroom then + conn:send(verse.presence{to=opts.to.."/"..(opts.nick or "clix")}); + end if opts.presence then conn:send(verse.presence()); end diff -r 80cc61512f10 -r cdeb02d9546d clix/send.lua --- a/clix/send.lua Thu Jan 07 20:59:15 2010 +0000 +++ b/clix/send.lua Thu Jan 07 21:22:27 2010 +0000 @@ -7,7 +7,9 @@ end local function on_connect(conn) local function send_message(text) - conn:send(verse.message({ to = opts.to, type = opts.type or "chat" }):body(text)); + conn:send(verse.message({ to = opts.to, + type = opts.type or (opts.chatroom and "groupchat") or "chat" }) + :body(text)); end if opts.interactive or opts.stdin then -- Fake socket object around stdin