Software /
code /
clix
Comparison
clix.lua @ 168:75e8ca131178
Update to handle Prosody module namespacing
This enables installation methods other than squish, such as luarocks
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 May 2023 22:39:38 +0200 |
parent | 166:b0c586241224 |
child | 169:4e67d34c1298 |
comparison
equal
deleted
inserted
replaced
167:57bb6e03d239 | 168:75e8ca131178 |
---|---|
10 -- Global to allow commands to add to it | 10 -- Global to allow commands to add to it |
11 short_opts = { v = "verbose", q = "quiet", t = "to", f = "from", e = "type", | 11 short_opts = { v = "verbose", q = "quiet", t = "to", f = "from", e = "type", |
12 a = "account", p = "password", r = "resource", o = "presence", c = "chatroom", i = "interactive", | 12 a = "account", p = "password", r = "resource", o = "presence", c = "chatroom", i = "interactive", |
13 f = "file" } | 13 f = "file" } |
14 | 14 |
15 | |
16 local commands = "adhoc archive avatar bounce export mirror moderate ping\ | |
17 presence publish_atom raw receive roster send sendfile sendfilecontent vcard\ | |
18 version watch_pep" | |
15 if #arg < 1 then | 19 if #arg < 1 then |
16 print("Command Line XMPP, available commands:"); | 20 print("Command Line XMPP, available commands:"); |
17 for module in pairs(package.preload) do | 21 for command in commands:gmatch("%S+") do |
18 if module:match("^clix%.") then | 22 local m = require("clix."..command); |
19 local m = require(module); | 23 io.write("\t", command, ": "); |
20 io.write("\t", module:gsub("^clix%.", ""), ": "); | 24 m({ short_help = true }, {}); |
21 m({ short_help = true }, {}); | |
22 end | |
23 end | 25 end |
24 return 0; | 26 return 0; |
25 end | 27 end |
26 | 28 |
27 local accounts = { default = {} }; | 29 local accounts = { default = {} }; |
115 account.password = read_password() | 117 account.password = read_password() |
116 end | 118 end |
117 | 119 |
118 local clientkey, serverkey = account.clientkey, account.serverkey; | 120 local clientkey, serverkey = account.clientkey, account.serverkey; |
119 if clientkey and serverkey then | 121 if clientkey and serverkey then |
120 local hex = require "util.hex"; | 122 local hex = require "prosody.util.hex"; |
121 clientkey = hex.from(clientkey); | 123 clientkey = hex.from(clientkey); |
122 serverkey = hex.from(serverkey); | 124 serverkey = hex.from(serverkey); |
123 elseif clientkey or serverkey then | 125 elseif clientkey or serverkey then |
124 conn:warn("Only one of 'clientkey' and 'serverkey' available, both reqired for SCRAM") | 126 conn:warn("Only one of 'clientkey' and 'serverkey' available, both reqired for SCRAM") |
125 clientkey, serverkey = nil, nil; | 127 clientkey, serverkey = nil, nil; |