Send SETNAME command if user edits realname field

This commit is contained in:
Pavel Djundik 2019-03-07 10:17:03 +02:00
parent d8b49f0fa5
commit 5d560c99b8

View file

@ -173,6 +173,7 @@ Network.prototype.createWebIrc = function(client) {
Network.prototype.edit = function(client, args) {
const oldNick = this.nick;
const oldRealname = this.realname;
this.nick = args.nick;
this.host = String(args.host || "");
@ -198,8 +199,10 @@ Network.prototype.edit = function(client, args) {
}
if (this.irc) {
const connected = this.irc.connection && this.irc.connection.connected;
if (this.nick !== oldNick) {
if (this.irc.connection && this.irc.connection.connected) {
if (connected) {
// Send new nick straight away
this.irc.raw("NICK", this.nick);
} else {
@ -213,6 +216,10 @@ Network.prototype.edit = function(client, args) {
}
}
if (connected && this.realname !== oldRealname) {
this.irc.raw("SETNAME", this.realname);
}
this.irc.options.host = this.host;
this.irc.options.port = this.port;
this.irc.options.password = this.password;