Consolidate irc-framework options
This commit is contained in:
parent
58553d7691
commit
3900e9dd81
@ -148,24 +148,17 @@ Network.prototype.validate = function (client) {
|
|||||||
Network.prototype.createIrcFramework = function (client) {
|
Network.prototype.createIrcFramework = function (client) {
|
||||||
this.irc = new IrcFramework.Client({
|
this.irc = new IrcFramework.Client({
|
||||||
version: false, // We handle it ourselves
|
version: false, // We handle it ourselves
|
||||||
host: this.host,
|
|
||||||
port: this.port,
|
|
||||||
nick: this.nick,
|
|
||||||
username: Helper.config.useHexIp ? Helper.ip2hex(client.config.browser.ip) : this.username,
|
|
||||||
gecos: this.realname,
|
|
||||||
password: this.password,
|
|
||||||
tls: this.tls,
|
|
||||||
outgoing_addr: Helper.config.bind,
|
outgoing_addr: Helper.config.bind,
|
||||||
rejectUnauthorized: this.rejectUnauthorized,
|
|
||||||
enable_chghost: true,
|
enable_chghost: true,
|
||||||
enable_echomessage: true,
|
enable_echomessage: true,
|
||||||
enable_setname: true,
|
enable_setname: true,
|
||||||
auto_reconnect: true,
|
auto_reconnect: true,
|
||||||
auto_reconnect_wait: 10000 + Math.floor(Math.random() * 1000), // If multiple users are connected to the same network, randomize their reconnections a little
|
auto_reconnect_wait: 10000 + Math.floor(Math.random() * 1000), // If multiple users are connected to the same network, randomize their reconnections a little
|
||||||
auto_reconnect_max_retries: 360, // At least one hour (plus timeouts) worth of reconnections
|
auto_reconnect_max_retries: 360, // At least one hour (plus timeouts) worth of reconnections
|
||||||
webirc: this.createWebIrc(client),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.setIrcFrameworkOptions(client);
|
||||||
|
|
||||||
this.irc.requestCap([
|
this.irc.requestCap([
|
||||||
"znc.in/self-message", // Legacy echo-message for ZNC
|
"znc.in/self-message", // Legacy echo-message for ZNC
|
||||||
]);
|
]);
|
||||||
@ -177,6 +170,20 @@ Network.prototype.createIrcFramework = function (client) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Network.prototype.setIrcFrameworkOptions = function (client) {
|
||||||
|
this.irc.options.host = this.host;
|
||||||
|
this.irc.options.port = this.port;
|
||||||
|
this.irc.options.password = this.password;
|
||||||
|
this.irc.options.nick = this.nick;
|
||||||
|
this.irc.options.username = Helper.config.useHexIp
|
||||||
|
? Helper.ip2hex(client.config.browser.ip)
|
||||||
|
: this.username;
|
||||||
|
this.irc.options.gecos = this.realname;
|
||||||
|
this.irc.options.tls = this.tls;
|
||||||
|
this.irc.options.rejectUnauthorized = this.rejectUnauthorized;
|
||||||
|
this.irc.options.webirc = this.createWebIrc(client);
|
||||||
|
};
|
||||||
|
|
||||||
Network.prototype.createWebIrc = function (client) {
|
Network.prototype.createWebIrc = function (client) {
|
||||||
if (
|
if (
|
||||||
!Helper.config.webirc ||
|
!Helper.config.webirc ||
|
||||||
@ -243,7 +250,7 @@ Network.prototype.edit = function (client, args) {
|
|||||||
// Send new nick straight away
|
// Send new nick straight away
|
||||||
this.irc.changeNick(this.nick);
|
this.irc.changeNick(this.nick);
|
||||||
} else {
|
} else {
|
||||||
this.irc.options.nick = this.irc.user.nick = this.nick;
|
this.irc.user.nick = this.nick;
|
||||||
|
|
||||||
// Update UI nick straight away if IRC is not connected
|
// Update UI nick straight away if IRC is not connected
|
||||||
client.emit("nick", {
|
client.emit("nick", {
|
||||||
@ -261,16 +268,10 @@ Network.prototype.edit = function (client, args) {
|
|||||||
this.irc.raw("SETNAME", this.realname);
|
this.irc.raw("SETNAME", this.realname);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.irc.options.host = this.host;
|
this.setIrcFrameworkOptions(client);
|
||||||
this.irc.options.port = this.port;
|
|
||||||
this.irc.options.password = this.password;
|
|
||||||
this.irc.options.gecos = this.irc.user.gecos = this.realname;
|
|
||||||
this.irc.options.tls = this.tls;
|
|
||||||
this.irc.options.rejectUnauthorized = this.rejectUnauthorized;
|
|
||||||
|
|
||||||
if (!Helper.config.useHexIp) {
|
this.irc.user.username = this.irc.options.username;
|
||||||
this.irc.options.username = this.irc.user.username = this.username;
|
this.irc.user.gecos = this.irc.options.gecos;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client.save();
|
client.save();
|
||||||
@ -297,6 +298,10 @@ Network.prototype.setNick = function (nick) {
|
|||||||
if (this.keepNick === nick) {
|
if (this.keepNick === nick) {
|
||||||
this.keepNick = null;
|
this.keepNick = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.irc) {
|
||||||
|
this.irc.options.nick = nick;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user