56 local account = accounts[opts.account or "default"]; |
56 local account = accounts[opts.account or "default"]; |
57 if not (account and account.jid) then |
57 if not (account and account.jid) then |
58 io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n"); |
58 io.stderr:write("The specified account (", opts.account or "default", ") wasn't found in the config file\n"); |
59 return nil; |
59 return nil; |
60 end |
60 end |
61 verse.set_logger(opts.verbose and print or function () end); |
61 verse.set_logger(opts.verbose and verse.logger() or function () end); |
62 local conn = verse.new(verse.logger()); |
62 local conn = verse.new(verse.logger()); |
63 conn.log.debug = opts.verbose; |
63 conn.log.debug = opts.verbose; |
64 conn:hook("authentication-failure", function (err) |
64 conn:hook("authentication-failure", function (err) |
65 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); |
65 conn:error("Authentication failure ("..(err.condition or "unknown error")..")"..(err.text and (": "..err.text) or "")); |
66 conn:close(); |
66 conn:close(); |