Add server password. Add rejectUnauthorized to disable SSL verification

This commit is contained in:
Rocco Zanni 2014-09-08 23:24:20 +02:00
parent 2f5be12d00
commit 86271f6ad0

View File

@ -72,10 +72,11 @@ Client.prototype.find = function(id) {
Client.prototype.connect = function(args) { Client.prototype.connect = function(args) {
var client = this; var client = this;
var server = { var server = _.defaults(_.pick(args, ['host', 'port', 'rejectUnauthorized']), {
host: args.host || "irc.freenode.org", host: "irc.freenode.org",
port: args.port || 6667 port: 6667,
}; rejectUnauthorized: true
});
var stream = args.tls ? tls.connect(server) : net.connect(server); var stream = args.tls ? tls.connect(server) : net.connect(server);
stream.on("error", function(e) { stream.on("error", function(e) {
@ -86,6 +87,11 @@ Client.prototype.connect = function(args) {
var realname = args.realname || "Shout User"; var realname = args.realname || "Shout User";
var irc = slate(stream); var irc = slate(stream);
if (args.password) {
irc.pass(args.password);
}
irc.me = nick; irc.me = nick;
irc.nick(nick); irc.nick(nick);
irc.user(nick, realname); irc.user(nick, realname);