Correctly save ip and hostname in user config

This commit is contained in:
Pavel Djundik 2016-11-19 22:23:51 +02:00
parent 708788338c
commit 4078abb085

View File

@ -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) {