Ignore nick change when there is a configured nick

The user has configured their nick and that's what we should use. If
they send a nick change, just reply letting them know what their nick
actually is.
This commit is contained in:
Stephen Paul Weber
2026-09-23 21:59:20 -05:00
parent d8bc3d17bb
commit c438554f9a
2 changed files with 49 additions and 0 deletions
@@ -0,0 +1,26 @@
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())]"),
# Configure a nickname in the database for this server
send_stanza("<iq type='set' id='conf1' from='{jid_one}/{resource_one}' to='{irc_server_one}'><command xmlns='http://jabber.org/protocol/commands' node='configure' action='execute' /></iq>"),
expect_stanza("/iq[@type='result']",
after = save_value("sessionid", extract_attribute("/iq[@type='result']/commands:command[@node='configure']", "sessionid"))),
send_stanza("<iq type='set' id='conf2' from='{jid_one}/{resource_one}' to='{irc_server_one}'>"
"<command xmlns='http://jabber.org/protocol/commands' node='configure' sessionid='{sessionid}' action='complete'>"
"<x xmlns='jabber:x:data' type='submit'>"
"<field var='nick'><value>{nick_one}</value></field>"
"</x></command></iq>"),
expect_stanza("/iq[@type='result']/commands:command[@node='configure'][@status='completed']/commands:note[@type='info'][text()='Configuration successfully applied.']"),
# Now with a DB nick configured, attempt to change nick: should reply with 110 + 210 presence rewriting to DB nick
send_stanza("<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/SomeOtherNick' />"),
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']",
"/presence/muc_user:x/muc_user:status[@code='210']"),
)