Merge pull request #3107 from thelounge/xpaw/setname
Send SETNAME command if user edits realname field
This commit is contained in:
commit
fb2206028c
@ -140,6 +140,7 @@ Network.prototype.createIrcFramework = function(client) {
|
||||
});
|
||||
|
||||
this.irc.requestCap([
|
||||
"draft/setname", // https://github.com/ircv3/ircv3-specifications/pull/361
|
||||
"znc.in/self-message", // Legacy echo-message for ZNC
|
||||
]);
|
||||
|
||||
@ -179,6 +180,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 || "");
|
||||
@ -204,8 +206,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 {
|
||||
@ -219,6 +223,10 @@ Network.prototype.edit = function(client, args) {
|
||||
}
|
||||
}
|
||||
|
||||
if (connected && this.realname !== oldRealname && this.irc.network.cap.isEnabled("draft/setname")) {
|
||||
this.irc.raw("SETNAME", this.realname);
|
||||
}
|
||||
|
||||
this.irc.options.host = this.host;
|
||||
this.irc.options.port = this.port;
|
||||
this.irc.options.password = this.password;
|
||||
|
Loading…
Reference in New Issue
Block a user