diff --git a/src/client.js b/src/client.js index c5d8aaee..e9310e65 100644 --- a/src/client.js +++ b/src/client.js @@ -176,6 +176,9 @@ Client.prototype.connect = function(args) { }); } + args.ip = args.ip || (client.config && client.config.ip) || client.ip; + args.hostname = args.hostname || (client.config && client.config.hostname) || client.hostname; + var network = new Network({ name: args.name || "", host: args.host || "", @@ -220,8 +223,9 @@ Client.prototype.connect = function(args) { } if (config.webirc && network.host in config.webirc) { - args.ip = args.ip || (client.config && client.config.ip) || client.ip; - args.hostname = args.hostname || (client.config && client.config.hostname) || client.hostname || args.ip; + if (!args.hostname) { + args.hostname = args.ip; + } if (args.ip) { if (config.webirc[network.host] instanceof Function) { @@ -260,7 +264,7 @@ Client.prototype.connect = function(args) { host: network.host, port: network.port, nick: nick, - username: config.useHexIp ? Helper.ip2hex(client.ip) : network.username, + username: config.useHexIp ? Helper.ip2hex(args.ip) : network.username, gecos: network.realname, password: network.password, tls: network.tls, @@ -271,6 +275,8 @@ Client.prototype.connect = function(args) { auto_reconnect_max_retries: 360, // At least one hour (plus timeouts) worth of reconnections webirc: webirc, }); + + client.save(); }; Client.prototype.updateToken = function(callback) {