Do not send NICK command when nick not changed

If we get a presence, that is not always a nick change. Don't bother the
IRC server with a command to change the nick if we're not changing it.
This commit is contained in:
Stephen Paul Weber
2026-09-23 21:57:29 -05:00
parent ff173a8ea3
commit 99d7f8a41a
2 changed files with 15 additions and 0 deletions
+3
View File
@@ -596,6 +596,9 @@ void Bridge::send_irc_nick_change(const Iid& iid, const std::string& new_nick, c
if (!res_in_chan)
return;
IrcClient* irc = this->get_irc_client(iid.get_server());
if (new_nick == irc->get_own_nick())
return;
irc->send_nick_command(new_nick);
}
@@ -0,0 +1,12 @@
from scenarios import *
scenario = (
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' ><x xmlns='http://jabber.org/protocol/muc'/></presence>"),
sequences.connection(),
expect_stanza("/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']",
"/presence/muc_user:x/muc_user:status[@code='110']"),
expect_stanza("/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"),
# Presence with the current nick (status update) should be ignored (no error, no change)
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}'><show>away</show></presence>"),
)